Skip to content

test

run move unit test with vitest you can run with report for full gas reports

usage:

test
test report

test command

shell
sui@deepmove>test

> wasm_test@1.0.0 test
> vitest run


 RUN  v3.0.8 E:/projects/wasm_test

 tests/wasm_tests.test.ts 24 tests 81ms
 wasm_tests > test get function 47ms (gas 1)
 wasm_tests > test get_vec function 4ms (gas 1)
 wasm_tests > test get_str function 0ms (gas 1)
 wasm_tests > test set_int function 1ms (gas 1)
 wasm_tests > test get_struct function 1ms (gas 1)
 wasm_tests > test set_struct no urls function 2ms (gas 1)
 wasm_tests > test set_struct urls function 1ms (gas 1)
 wasm_tests > test set_struct_t function 2ms (gas 1)
 wasm_tests > test set_struct_t2 function 1ms (gas 1)
 wasm_tests > test set_foo2 function 2ms (gas 1)
 wasm_tests > test set_foo_str function 1ms (gas 1)
 wasm_tests > test set_foo function 1ms (gas 1)
 wasm_tests > test set_foo_vector function 0ms (gas 1)
 wasm_tests > test set_foo_vector2 function 1ms (gas 1)
 wasm_tests > test set_foo_vector3 function 0ms (gas 1)
 wasm_tests > test set_foo_vector5 function 1ms (gas 1)
 wasm_tests > test get_foo function 1ms (gas 1)
 wasm_tests > test set_foo3 function 1ms (gas 1)
 wasm_tests > test set_foo5 function 1ms (gas 1)
 wasm_tests > test set_foo6 function 2ms (gas 1)
 wasm_tests > test get_sui_url function 3ms (gas 3)
 wasm_tests > test get_online_val function 0ms (gas 1)
 wasm_tests > test set_mut_string function 1ms (gas 3)
 wasm_tests > test set_foo7 function 1ms (gas 1)
 tests/justin_coin_6.test.ts 2 tests 105ms
 justin_coin_6_test > test init coin 95ms (gas 11)
 justin_coin_6_test2 > test init coin 2 5ms (gas 11)

 Test Files  2 passed (2)
      Tests  26 passed (26)
   Start at  14:18:14
   Duration  1.66s (transform 240ms, setup 0ms, collect 2.31s, tests 185ms, environment 0ms, prepare 280ms)

test report command

test report
shell
sui@deepmove>test report

> wasm_test@1.0.0 test
> vitest run


 RUN  v3.0.8 E:/projects/wasm_test

 tests/wasm_tests.test.ts 24 tests 85ms
 wasm_tests > test get function 53ms (gas 1)
 wasm_tests > test get_vec function 5ms (gas 1)
 wasm_tests > test get_str function 0ms (gas 1)
 wasm_tests > test set_int function 1ms (gas 1)
 wasm_tests > test get_struct function 1ms (gas 1)
 wasm_tests > test set_struct no urls function 2ms (gas 1)
 wasm_tests > test set_struct urls function 1ms (gas 1)
 wasm_tests > test set_struct_t function 2ms (gas 1)
 wasm_tests > test set_struct_t2 function 1ms (gas 1)
 wasm_tests > test set_foo2 function 1ms (gas 1)
 wasm_tests > test set_foo_str function 1ms (gas 1)
 wasm_tests > test set_foo function 1ms (gas 1)
 wasm_tests > test set_foo_vector function 0ms (gas 1)
 wasm_tests > test set_foo_vector2 function 1ms (gas 1)
 wasm_tests > test set_foo_vector3 function 0ms (gas 1)
 wasm_tests > test set_foo_vector5 function 1ms (gas 1)
 wasm_tests > test get_foo function 0ms (gas 1)
 wasm_tests > test set_foo3 function 1ms (gas 1)
 wasm_tests > test set_foo5 function 1ms (gas 1)
 wasm_tests > test set_foo6 function 1ms (gas 1)
 wasm_tests > test get_sui_url function 2ms (gas 3)
 wasm_tests > test get_online_val function 1ms (gas 1)
 wasm_tests > test set_mut_string function 2ms (gas 3)
 wasm_tests > test set_foo7 function 1ms (gas 1)
 tests/justin_coin_6.test.ts 2 tests 107ms
 justin_coin_6_test > test init coin 97ms (gas 11)
 justin_coin_6_test2 > test init coin 2 5ms (gas 11)

 Test Files  2 passed (2)
      Tests  26 passed (26)
   Start at  14:19:11
   Duration  1.74s (transform 267ms, setup 0ms, collect 2.37s, tests 192ms, environment 0ms, prepare 294ms)


Gas Reports

╔════════════════════════════════════════════════════════════════════╤═══════════════╤═════╤════════╤═════╤═══════╗
 address module
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 0x0000000000000000000000000000000000000000000000000000000000000000 justin_coin_6
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 function min avg median max calls
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 init 3 3 3 3 2
╚════════════════════════════════════════════════════════════════════╧═══════════════╧═════╧════════╧═════╧═══════╝
╔════════════════════════════════════════════════════════════════════╤═══════════════╤═════╤════════╤═════╤═══════╗
 address module
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 0x0000000000000000000000000000000000000000000000000000000000000002 test_scenario
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 function min avg median max calls
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 begin 2 2 2 2 2
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 ctx 1 1 1 1 2
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 end 1 1 1 1 2
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 next_tx 3 3 3 3 2
╟────────────────────────────────────────────────────────────────────┼───────────────┼─────┼────────┼─────┼───────╢
 take_shared 1 1 1 1 2
╚════════════════════════════════════════════════════════════════════╧═══════════════╧═════╧════════╧═════╧═══════╝
╔════════════════════════════════════════════════════════════════════╤═══════════╤═════╤════════╤═════╤═══════╗
 address module
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 0x0000000000000000000000000000000000000000000000000000000000000000 wasm_test
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 function min avg median max calls
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_foo 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_online_val 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_str 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_struct 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_sui_url 3 3 3 3 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 get_vec 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo2 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo3 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo5 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo6 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo7 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_str 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector2 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector3 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_foo_vector5 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_int 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_mut_string 3 3 3 3 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct 1 1 1 1 2
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct_t 1 1 1 1 1
╟────────────────────────────────────────────────────────────────────┼───────────┼─────┼────────┼─────┼───────╢
 set_struct_t2 1 1 1 1 1
╚════════════════════════════════════════════════════════════════════╧═══════════╧═════╧════════╧═════╧═══════╝

Released under the MIT License.