diff --git a/emscripten/test_cqasm.js b/emscripten/test_cqasm.js index 4b69bb98..e6050292 100644 --- a/emscripten/test_cqasm.js +++ b/emscripten/test_cqasm.js @@ -34,7 +34,7 @@ wrapper().then(function(result) { try { var program_2 = "version 3;qubit[5] q;h q[0:4];measure q" output = cqasm.parse_string_to_json(program_2, "") - expected_output = String.raw`{"Program":{"version":{"Version":{"items":"3","source_location":":1:9..10"}},"block":{"GlobalBlock":{"qubit_variable_declaration":{"Variable":{"name":{"Identifier":{"name":"q"}},"typ":{"Type":{"name":{"Keyword":{"name":"qubit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":":1:11..19"}},"annotations":"[]","source_location":":1:20..21"}},"gates":[{"Gate":{"name":{"Identifier":{"name":"h"}},"operands":{"ExpressionList":{"items":[{"Index":{"expr":{"Identifier":{"name":"q"}},"indices":{"IndexList":{"items":[{"IndexRange":{"first":{"IntegerLiteral":{"value":"0","source_location":":1:26..27"}},"last":{"IntegerLiteral":{"value":"4","source_location":":1:28..29"}}}}]}},"source_location":":1:24..25"}}]}},"annotations":"[]","source_location":":1:22..23"}}],"measure_instruction":{"MeasureInstruction":{"name":{"Identifier":{"name":"measure"}},"operands":{"ExpressionList":{"items":[{"Identifier":{"name":"q","source_location":":1:39..40"}}]}},"annotations":"[]","source_location":":1:31..38"}}}}}}` + expected_output = String.raw`{"Program":{"version":{"Version":{"items":"3","source_location":":1:9..10"}},"block":{"GlobalBlock":{"qubit_variable_declaration":{"Variable":{"name":{"Identifier":{"name":"q"}},"typ":{"Type":{"name":{"Keyword":{"name":"qubit"}},"size":{"IntegerLiteral":{"value":"5"}},"source_location":":1:11..19"}},"annotations":"[]","source_location":":1:20..21"}},"gates":[{"Gate":{"name":{"Identifier":{"name":"h"}},"operands":{"ExpressionList":{"items":[{"Index":{"expr":{"Identifier":{"name":"q"}},"indices":{"IndexList":{"items":[{"IndexRange":{"first":{"IntegerLiteral":{"value":"0","source_location":":1:26..27"}},"last":{"IntegerLiteral":{"value":"4","source_location":":1:28..29"}}}}]}},"source_location":":1:24..25"}}]}},"annotations":"[]","source_location":":1:22..23"}}],"measure_instruction":{"MeasureInstruction":{"name":{"Identifier":{"name":"measure"}},"operand":{"Identifier":{"name":"q","source_location":":1:39..40"}},"annotations":"[]","source_location":":1:31..38"}}}}}}` console.log("\nExample 2:", program_2, "\n\tCalling parse_string_to_json...", "\n\tOutput:", output) if (output !== expected_output) { console.log("\tExpected output:", expected_output)