-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathparser.test.ts
More file actions
50 lines (40 loc) · 1.38 KB
/
parser.test.ts
File metadata and controls
50 lines (40 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { circomkit, WitnessTester, readJSONInputFile } from "../common";
describe("JSON Parser", () => {
let circuit: WitnessTester<["data"]>;
it(`array only input`, async () => {
let filename = "array_only";
let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, []);
circuit = await circomkit.WitnessTester(`Parser`, {
file: "json/parser",
template: "Parser",
params: [input.length, 2],
});
await circuit.expectPass({
data: input
});
});
it(`object input`, async () => {
let filename = "value_object";
let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, []);
circuit = await circomkit.WitnessTester(`Parser`, {
file: "json/parser",
template: "Parser",
params: [input.length, 3],
});
await circuit.expectPass({
data: input
});
});
it(`string_escape input`, async () => {
let filename = "string_escape";
let [input, keyUnicode, output] = readJSONInputFile(`${filename}.json`, []);
circuit = await circomkit.WitnessTester(`Parser`, {
file: "json/parser",
template: "Parser",
params: [input.length, 3],
});
await circuit.expectPass({
data: input
});
});
})