Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 23 additions & 8 deletions test/simple_adder_vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,43 @@ const toResult = (data) => {
contract('SimpleAdderVM', function(accounts) {
let simpleAdderVM

let program = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"]
let program = [
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x0000000000000000000000000000000000000000000000000000000000000004",
"0x0000000000000000000000000000000000000000000000000000000000000005",
"0x0000000000000000000000000000000000000000000000000000000000000006",
"0x0000000000000000000000000000000000000000000000000000000000000007",
"0x0000000000000000000000000000000000000000000000000000000000000008",
"0x0000000000000000000000000000000000000000000000000000000000000009"
]

before(async () => {
simpleAdderVM = await SimpleAdderVM.deployed()
})

it("should merklize state", async () => {
assert.equal(
"0xce14df43546288f0a098d4057077c167f41c3cbcd4011965d53430d2e99d3dfb",
await simpleAdderVM.merklizeState.call(["1", "2", "3", "4"])
"0x5b462f578537e091d2e07e7a9ce57dd98b869843ef18fbcf05a78900cbd9841b",
await simpleAdderVM.merklizeState.call([
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000002",
"0x0000000000000000000000000000000000000000000000000000000000000003",
"0x0000000000000000000000000000000000000000000000000000000000000004",
])
)
})

it("should run a step", async () => {
assert.deepEqual(
await simpleAdderVM.runStep.call(
["0x00", "0x00", "0x00", "0x00"],
["0x00", "0x00", "0x00"],
"0x0000000000000000000000000000000000000000000000000000000000000001",
"0x0000000000000000000000000000000000000000000000000000000000000001"
),
[ '0x0000000000000000000000000000000000000000000000000000000000000001',
'0x0000000000000000000000000000000000000000000000000000000000000000',
'0x0000000000000000000000000000000000000000000000000000000000000001',
'0x0000000000000000000000000000000000000000000000000000000000000001'
]
Expand All @@ -43,11 +59,10 @@ contract('SimpleAdderVM', function(accounts) {
await simpleAdderVM.runSteps.call(program, 5),
[
[ '0x0000000000000000000000000000000000000000000000000000000000000004',
'0x0000000000000000000000000000000000000000000000000000000000000004',
'0x0000000000000000000000000000000000000000000000000000000000000006',
'0x000000000000000000000000000000000000000000000000000000000000000a',
'0x0000000000000000000000000000000000000000000000000000000000000005'
],
'0x00b6b0f456d4b05f44bd2f7ad745e2350d8dfd0bd68cdda97c011e988ca58998'
'0x7399a9b676993b56ca6d584f739e60fe0bc6e7b527b3196ed9ee8086cfa08599'
]
)
})
Expand Down