Skip to content

Commit

Permalink
wasm/rotational-cipher: 3rd iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vpayno committed Nov 28, 2023
1 parent 06d0acb commit 46a7917
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 47 deletions.
4 changes: 2 additions & 2 deletions wasm/rotational-cipher/coverage/clover.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<coverage generated="1701156821488" clover="3.2.0">
<project timestamp="1701156821488" name="All files">
<coverage generated="1701158978322" clover="3.2.0">
<project timestamp="1701158978322" name="All files">
<metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
</project>
</coverage>
2 changes: 1 addition & 1 deletion wasm/rotational-cipher/coverage/lcov-report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h1>All files</h1>
<div class='footer quiet pad2 space-top1 center small'>
Code coverage generated by
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
at 2023-11-28T07:33:41.486Z
at 2023-11-28T08:09:38.320Z
</div>
<script src="prettify.js"></script>
<script>
Expand Down
13 changes: 2 additions & 11 deletions wasm/rotational-cipher/rotational-cipher.wat
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

(memory (export "mem") 1)

(global $false i32 (i32.const 0))
(global $true i32 (i32.const 1))

;; 0=>false/disable, 1=>true/enable
(global $debug i32 (i32.const 1))

Expand Down Expand Up @@ -171,10 +168,7 @@
;; print i32u if debugging is enabled
(func $debug_print_i32u (export "debug_print_i32u") (param $value i32)
(if
(i32.eq
(global.get $debug)
(global.get $true)
) ;; eq
(global.get $debug)
(then
(call $log_i32_u (local.get $value))
) ;; then
Expand All @@ -184,10 +178,7 @@
;; print utf-8 str if debugging is enabled
(func $debug_print_str (export "debug_print_str") (param $offset i32) (param $length i32)
(if
(i32.eq
(global.get $debug)
(global.get $true)
) ;; eq
(global.get $debug)
(then
(call $log_mem_as_utf8 (local.get $offset) (local.get $length))
) ;; then
Expand Down
66 changes: 33 additions & 33 deletions wasm/rotational-cipher/run-tests-wasm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,35 +21,35 @@ Running: js-beautify ./babel.config.js ./rotational-cipher.spec.js
beautified babel.config.js - unchanged
beautified rotational-cipher.spec.js - unchanged

real 0m0.083s
user 0m0.074s
sys 0m0.023s
real 0m0.091s
user 0m0.079s
sys 0m0.019s


==============================================================================

Exit code: 0

real 0m0.428s
user 0m0.421s
sys 0m0.091s
real 0m0.384s
user 0m0.366s
sys 0m0.070s

real 0m0.430s
user 0m0.422s
sys 0m0.093s
real 0m0.388s
user 0m0.367s
sys 0m0.073s

===============================================================================

Running: npm install

up to date in 505ms
up to date in 485ms

107 packages are looking for funding
run `npm fund` for details

real 0m0.656s
user 0m0.868s
sys 0m0.081s
real 0m0.635s
user 0m0.814s
sys 0m0.076s

===============================================================================

Expand Down Expand Up @@ -82,7 +82,7 @@ Running: npm run test -- --coverage
> test
> node --experimental-vm-modules node_modules/jest/bin/jest.js ./* --coverage

(node:11232) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(node:10299) ExperimentalWarning: VM Modules is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
console.log
plain
Expand Down Expand Up @@ -386,16 +386,16 @@ Running: npm run test -- --coverage

PASS ./rotational-cipher.spec.js
Rotational Cipher
✓ rotate a by 0, same output as input (22 ms)
✓ rotate a by 1 (5 ms)
✓ rotate a by 0, same output as input (24 ms)
✓ rotate a by 1 (6 ms)
✓ rotate a by 26, same output as input (5 ms)
✓ rotate m by 13 (5 ms)
✓ rotate n by 13 with wrap around alphabet (4 ms)
✓ rotate capital letters (5 ms)
✓ rotate spaces (5 ms)
✓ rotate n by 13 with wrap around alphabet (5 ms)
✓ rotate capital letters (4 ms)
✓ rotate spaces (4 ms)
✓ rotate numbers (4 ms)
✓ rotate punctuation (4 ms)
✓ rotate all letters (5 ms)
✓ rotate all letters (4 ms)

----------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
Expand All @@ -405,33 +405,33 @@ All files | 0 | 0 | 0 | 0 |
Test Suites: 1 passed, 1 total
Tests: 10 passed, 10 total
Snapshots: 0 total
Time: 0.37 s, estimated 1 s
Time: 0.355 s, estimated 1 s
Ran all test suites matching /.\/HELP.md|.\/LICENSE|.\/README.md|.\/babel.config.js|.\/node_modules|.\/package-lock.json|.\/package.json|.\/rotational-cipher.spec.js|.\/rotational-cipher.wat|.\/run-tests-wasm.txt/i.

real 0m0.950s
user 0m0.846s
sys 0m0.174s
real 0m0.916s
user 0m0.867s
sys 0m0.120s


==============================================================================

Exit code: 0

real 0m1.245s
user 0m1.157s
sys 0m0.226s
real 0m1.203s
user 0m1.137s
sys 0m0.183s

real 0m1.248s
user 0m1.158s
sys 0m0.227s
real 0m1.206s
user 0m1.137s
sys 0m0.185s

===============================================================================

Running: misspell ./rotational-cipher.wat

real 0m0.029s
user 0m0.027s
sys 0m0.016s
real 0m0.039s
user 0m0.038s
sys 0m0.021s

===============================================================================

Expand Down

0 comments on commit 46a7917

Please sign in to comment.