diff --git a/applications/cybersecurity/link_monitoring/link_monitoring.ipynb b/applications/cybersecurity/link_monitoring/link_monitoring.ipynb index 20ed5d3af..c31b4cbd2 100644 --- a/applications/cybersecurity/link_monitoring/link_monitoring.ipynb +++ b/applications/cybersecurity/link_monitoring/link_monitoring.ipynb @@ -653,7 +653,7 @@ "source": [ "from classiq import execute\n", "\n", - "res = execute(qprog).result()" + "result = execute(qprog).result_value()" ] }, { @@ -698,7 +698,7 @@ "source": [ "from classiq.execution import VQESolverResult\n", "\n", - "vqe_result = VQESolverResult.parse_obj(res[0].value)\n", + "vqe_result = VQESolverResult.parse_obj(result)\n", "vqe_result.convergence_graph" ] }, diff --git a/applications/cybersecurity/link_monitoring/link_monitoring.synthesis_options.json b/applications/cybersecurity/link_monitoring/link_monitoring.synthesis_options.json index 0967ef424..c33a23520 100644 --- a/applications/cybersecurity/link_monitoring/link_monitoring.synthesis_options.json +++ b/applications/cybersecurity/link_monitoring/link_monitoring.synthesis_options.json @@ -1 +1,44 @@ -{} +{ + "constraints": { + "max_gate_count": {}, + "optimization_parameter": "no_opt" + }, + "preferences": { + "machine_precision": 8, + "custom_hardware_settings": { + "basis_gates": [ + "cx", + "t", + "u2", + "x", + "tdg", + "s", + "id", + "ry", + "sx", + "cy", + "y", + "r", + "sdg", + "u", + "sxdg", + "z", + "cz", + "rx", + "h", + "p", + "u1", + "rz" + ], + "is_symmetric_connectivity": true + }, + "debug_mode": true, + "synthesize_all_separately": false, + "optimization_level": 3, + "output_format": ["qasm"], + "pretty_qasm": true, + "transpilation_option": "auto optimize", + "timeout_seconds": 300, + "random_seed": 3117123804 + } +} diff --git a/applications/cybersecurity/patching_management/patching_managment.ipynb b/applications/cybersecurity/patching_management/patching_managment.ipynb index bc9c415aa..02f296cc6 100644 --- a/applications/cybersecurity/patching_management/patching_managment.ipynb +++ b/applications/cybersecurity/patching_management/patching_managment.ipynb @@ -748,7 +748,7 @@ "source": [ "from classiq import execute\n", "\n", - "res = execute(qprog).result()" + "result = execute(qprog).result_value()" ] }, { @@ -793,7 +793,7 @@ "source": [ "from classiq.execution import VQESolverResult\n", "\n", - "vqe_result = VQESolverResult.parse_obj(res[0].value)\n", + "vqe_result = VQESolverResult.parse_obj(result)\n", "vqe_result.convergence_graph" ] }, diff --git a/applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.ipynb b/applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.ipynb index 18283c15e..3ff83bb96 100644 --- a/applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.ipynb +++ b/applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.ipynb @@ -311,8 +311,9 @@ " my_oracle(predicate=lambda q: my_predicate(x, y, q))\n", "\n", "\n", + "MAX_WIDTH_ORACLE = 25\n", "qmod_oracle = create_model(main)\n", - "qmod_oracle = set_constraints(qmod_oracle, max_width=25)\n", + "qmod_oracle = set_constraints(qmod_oracle, max_width=MAX_WIDTH_ORACLE)\n", "qprog_oracle = synthesize(qmod_oracle)\n", "show(qprog_oracle)" ] @@ -527,7 +528,8 @@ "metadata": {}, "outputs": [], "source": [ - "qmod_grover = set_constraints(qmod_grover, max_width=25)\n", + "MAX_WIDTH_GROVER = 25\n", + "qmod_grover = set_constraints(qmod_grover, max_width=MAX_WIDTH_GROVER)\n", "write_qmod(qmod_grover, \"whitebox_fuzzing\")" ] }, diff --git a/tests/notebooks/test_link_monitoring.py b/tests/notebooks/test_link_monitoring.py new file mode 100644 index 000000000..2735510bd --- /dev/null +++ b/tests/notebooks/test_link_monitoring.py @@ -0,0 +1,21 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("link_monitoring", timeout_seconds=76) +def test_notebook(tb: TestbookNotebookClient) -> None: + # test models + validate_quantum_model(tb.ref("qmod")) + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog"), + expected_width=15, # actual width: 12 + expected_depth=35, # actual depth: 23 + ) + + # test notebook content + pass # Todo diff --git a/tests/notebooks/test_patching_managment.py b/tests/notebooks/test_patching_managment.py new file mode 100644 index 000000000..739154178 --- /dev/null +++ b/tests/notebooks/test_patching_managment.py @@ -0,0 +1,21 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("patching_managment", timeout_seconds=36) +def test_notebook(tb: TestbookNotebookClient) -> None: + # test models + validate_quantum_model(tb.ref("qmod")) + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog"), + expected_width=10, # actual width: 8 + expected_depth=35, # actual depth: 26 + ) + + # test notebook content + pass # Todo diff --git a/tests/notebooks/test_whitebox_fuzzing.py b/tests/notebooks/test_whitebox_fuzzing.py new file mode 100644 index 000000000..116e4a790 --- /dev/null +++ b/tests/notebooks/test_whitebox_fuzzing.py @@ -0,0 +1,27 @@ +from tests.utils_for_testbook import ( + validate_quantum_program_size, + validate_quantum_model, + wrap_testbook, +) +from testbook.client import TestbookNotebookClient + + +@wrap_testbook("whitebox_fuzzing", timeout_seconds=720) +def test_notebook(tb: TestbookNotebookClient) -> None: + # test models + validate_quantum_model(tb.ref("qmod_oracle")) + validate_quantum_model(tb.ref("qmod_grover")) + # test quantum programs + validate_quantum_program_size( + tb.ref("qprog_oracle"), + expected_width=tb.ref("MAX_WIDTH_ORACLE"), + expected_depth=700, # actual depth: 626 + ) + validate_quantum_program_size( + tb.ref("qprog_grover"), + expected_width=tb.ref("MAX_WIDTH_GROVER"), + expected_depth=4500, # actual depth: 4044 + ) + + # test notebook content + pass # Todo