diff --git a/exercises/practice/rotational-cipher/.docs/instructions.append.md b/exercises/practice/rotational-cipher/.docs/instructions.append.md new file mode 100644 index 0000000..a62a79d --- /dev/null +++ b/exercises/practice/rotational-cipher/.docs/instructions.append.md @@ -0,0 +1,5 @@ +## Reserved Memory + +Bytes 64-319 of the linear memory are reserved for the input string. + +The input string can be modified in place if desired. \ No newline at end of file diff --git a/exercises/practice/rotational-cipher/.meta/proof.ci.wat b/exercises/practice/rotational-cipher/.meta/proof.ci.wat index 0817d2a..df44c0e 100644 --- a/exercises/practice/rotational-cipher/.meta/proof.ci.wat +++ b/exercises/practice/rotational-cipher/.meta/proof.ci.wat @@ -1,6 +1,11 @@ (module (memory (export "mem") 1) + (global $A i32 (i32.const 65)) + (global $Z i32 (i32.const 90)) + (global $a i32 (i32.const 97)) + (global $z i32 (i32.const 122)) + (func $wrap (param $low i32) (param $high i32) (param $value i32) (param $shiftKey i32) (result i32) (local $newValue i32) (local.set $newValue (local.get $value)) @@ -63,8 +68,8 @@ ;; shift upper case (local.set $value (call $wrap - (i32.const 65) - (i32.const 90) + (global.get $A) + (global.get $Z) (i32.load8_u (local.get $index)) (local.get $shiftKey) ) @@ -73,8 +78,8 @@ ;; shift lower case (local.set $value (call $wrap - (i32.const 97) - (i32.const 122) + (global.get $a) + (global.get $z) (local.get $value) (local.get $shiftKey) ) diff --git a/exercises/practice/rotational-cipher/rotational-cipher.spec.js b/exercises/practice/rotational-cipher/rotational-cipher.spec.js index 2577326..4b0d7eb 100644 --- a/exercises/practice/rotational-cipher/rotational-cipher.spec.js +++ b/exercises/practice/rotational-cipher/rotational-cipher.spec.js @@ -1,5 +1,4 @@ import { compileWat, WasmRunner } from "@exercism/wasm-lib"; -import exp from "constants"; let wasmModule; let currentInstance; @@ -58,39 +57,39 @@ describe("Rotational Cipher", () => { expect(rotate("a", 0)).toEqual("a"); }); - test("rotate a by 1", () => { + xtest("rotate a by 1", () => { expect(rotate("a", 1)).toEqual("b"); }); - test("rotate a by 26, same output as input", () => { + xtest("rotate a by 26, same output as input", () => { expect(rotate("a", 26)).toEqual("a"); }); - test("rotate m by 13", () => { + xtest("rotate m by 13", () => { expect(rotate("m", 13)).toEqual("z"); }); - test("rotate n by 13 with wrap around alphabet", () => { + xtest("rotate n by 13 with wrap around alphabet", () => { expect(rotate("n", 13)).toEqual("a"); }); - test("rotate capital letters", () => { + xtest("rotate capital letters", () => { expect(rotate("OMG", 5)).toEqual("TRL"); }); - test("rotate spaces", () => { + xtest("rotate spaces", () => { expect(rotate("O M G", 5)).toEqual("T R L"); }); - test("rotate numbers", () => { + xtest("rotate numbers", () => { expect(rotate("Testing 1 2 3 testing", 4)).toEqual("Xiwxmrk 1 2 3 xiwxmrk"); }); - test("rotate punctuation", () => { + xtest("rotate punctuation", () => { expect(rotate("Let's eat, Grandma!", 21)).toEqual("Gzo'n zvo, Bmviyhv!"); }); - test("rotate all letters", () => { + xtest("rotate all letters", () => { expect(rotate("The quick brown fox jumps over the lazy dog.", 13)).toEqual("Gur dhvpx oebja sbk whzcf bire gur ynml qbt."); }); }); \ No newline at end of file