-
Notifications
You must be signed in to change notification settings - Fork 41
/
SigmaCompiler.spec.js
30 lines (23 loc) · 1.08 KB
/
SigmaCompiler.spec.js
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
const { Value$, SigmaCompiler$ } = require("sigmastate-js/main");
describe("Smoke tests for API exporting", () => {
let compiler = SigmaCompiler$.forMainnet();
it("Should create SigmaCompiler", () => {
expect(compiler).not.toBeUndefined();
});
let segregatedTreeHex = "100104c801d191a37300";
let embedddedTreeHex = "00d191a304c801";
it("SigmaCompiler should compile", () => {
let treeWithSegregation = compiler.compile({}, true, 0, "sigmaProp(HEIGHT > 100)");
expect(treeWithSegregation).not.toBeUndefined();
expect(treeWithSegregation.toHex()).toEqual(segregatedTreeHex)
let treeWithoutSegregation = compiler.compile({}, false, 0, "sigmaProp(HEIGHT > 100)");
expect(treeWithoutSegregation.toHex()).toEqual(embedddedTreeHex)
});
it("SigmaCompiler should compile with named constants", () => {
let treeWithSegregation = compiler.compile(
{"deadline": Value$.ofInt(100)},
true, 0, "sigmaProp(HEIGHT > deadline)");
expect(treeWithSegregation).not.toBeUndefined();
expect(treeWithSegregation.toHex()).toEqual(segregatedTreeHex)
});
});