Skip to content

Commit

Permalink
Tests use inputLengthEncoded (#140)
Browse files Browse the repository at this point in the history
[no important files changed]
  • Loading branch information
keiravillekode authored Jan 3, 2025
1 parent 4d51049 commit 1febd9b
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion exercises/practice/matching-brackets/matching-brackets.wat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(module
(memory (export "mem") 1)

;; Determines of the brackets in a string is balanced.
;; Determines if the brackets in a string are balanced.
;;
;; @param {i32} text - the offset where the text string begins in memory
;; @param {i32} length - the length of the text
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function countNucleotides(input) {
// Pass offset and length to WebAssembly function
return currentInstance.exports.countNucleotides(
inputBufferOffset,
input.length
inputLengthEncoded
);
}

Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/reverse-string/reverse-string.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function reverseString(input) {
// Pass offset and length to WebAssembly function
const [outputOffset, outputLength] = currentInstance.exports.reverseString(
inputBufferOffset,
input.length
inputLengthEncoded
);
expect(outputLength).toEqual(inputLengthEncoded);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function toRna(input) {
// Pass offset and length to WebAssembly function
const [outputOffset, outputLength] = currentInstance.exports.toRna(
inputBufferOffset,
input.length
inputLengthEncoded
);
expect(outputLength).toEqual(input.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function rotate(text, shiftKey) {

const [outputOffset, outputLength] = currentInstance.exports.rotate(
inputBufferOffset,
text.length,
inputLengthEncoded,
shiftKey
);
expect(outputLength).toEqual(text.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function invoke(funcName, input) {

const [ outputOffset, outputLength ] = currentInstance.exports[funcName](
inputBufferOffset,
input.length
inputLengthEncoded
);

return currentInstance.get_mem_as_utf8(outputOffset, outputLength);
Expand Down
2 changes: 1 addition & 1 deletion exercises/practice/two-fer/two-fer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function twoFer(input = "") {
// Pass offset and length to WebAssembly function
const [outputOffset, outputLength] = currentInstance.exports.twoFer(
inputOffset,
input.length
inputLengthEncoded
);

// Decode JS string from returned offset and length
Expand Down

0 comments on commit 1febd9b

Please sign in to comment.