Skip to content

Commit

Permalink
test: add couples tests for WasmModuleHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
qartik committed Oct 9, 2024
1 parent 929614c commit 59b80c7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pytket/tests/classical_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ def test_wasm_3() -> None:
assert c.depth() == 1


def test_wasm_3_bytes() -> None:
with open("testfile.wasm", "rb") as f:
bytecode = f.read()
c = Circuit(0, 6)

w = wasm.WasmModuleHandler(bytecode)

c.add_wasm("add_one", w, [1], [1], [Bit(0), Bit(1)])

assert c.depth() == 1


def test_wasm_4() -> None:
w = wasm.WasmFileHandler("testfile.wasm")

Expand Down Expand Up @@ -412,6 +424,19 @@ def test_wasm_function_check_6() -> None:
assert c.depth() == 1


def test_wasm_function_check_6_bytes() -> None:
with open("testfile.wasm", "rb") as f:
bytecode = f.read()

w = wasm.WasmModuleHandler(bytecode)
c = Circuit(20, 20)
c0 = c.add_c_register("c0", 32)
c1 = c.add_c_register("c1", 4)

c.add_wasm_to_reg("add_one", w, [c0], [c1])
assert c.depth() == 1


def test_wasm_function_check_7() -> None:
w = wasm.WasmFileHandler("testfile.wasm", int_size=32)
c = Circuit(20, 20)
Expand Down

0 comments on commit 59b80c7

Please sign in to comment.