Skip to content

Commit

Permalink
Add sort unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
exqlnet committed Mar 13, 2024
1 parent cec3d7b commit ba681e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions merkletree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ var tests = []struct {
dot: "digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval];\"Foo\"->2 [label=\"+00000000\"];2 [label=\"2434…cfac\"];2->1;\"Bar\" [shape=oval];\"Bar\"->3 [label=\"+00000001\"];3 [label=\"f40e…406d\"];2->3 [style=invisible arrowhead=none];3->1;{rank=same;2;3};1 [label=\"8d18…354d\"];}",
salt: true,
saltedRoot: _byteArray("8d18bf1d3ce24f418ded32b60e8881f60ce658bb33b0cfbbc152fcb3aac8354d"),
sortedRoot: _byteArray("586b87a66d48dfa411bb3f7dd39a157e92cbd65fce56eccd86be5473a434480e"),
sortedPairsRoot: _byteArray("586b87a66d48dfa411bb3f7dd39a157e92cbd65fce56eccd86be5473a434480e"),
sortedLeavesRoot: _byteArray("586b87a66d48dfa411bb3f7dd39a157e92cbd65fce56eccd86be5473a434480e"),
fillDefaultRoot: _byteArray("e9e0083e456539e9f6336164cd98700e668178f98af147ef750eb90afcf2f637"),
Expand All @@ -102,6 +103,7 @@ var tests = []struct {
dot: "digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval];\"Foo\"->2 [label=\"+00000000\"];2 [label=\"0b34…c7b9\"];2->1;\"Bar\" [shape=oval];\"Bar\"->3 [label=\"+00000001\"];3 [label=\"5621…a66c\"];2->3 [style=invisible arrowhead=none];3->1;{rank=same;2;3};1 [label=\"e637…f3b6\"];}",
salt: true,
saltedRoot: _byteArray("e6379b212ee745a62d259ecf0bcccd316d67782a159ded7a88ac788c64b3f3b6"),
sortedRoot: _byteArray("fb6c3a47aacb11c3f7ee3717cfbd43e4ad08da66d2cb049358db7e056baaaeed"),
sortedPairsRoot: _byteArray("fb6c3a47aacb11c3f7ee3717cfbd43e4ad08da66d2cb049358db7e056baaaeed"),
sortedLeavesRoot: _byteArray("fb6c3a47aacb11c3f7ee3717cfbd43e4ad08da66d2cb049358db7e056baaaeed"),
fillDefaultRoot: _byteArray("fb6c3a47aacb11c3f7ee3717cfbd43e4ad08da66d2cb049358db7e056baaaeed"),
Expand All @@ -113,6 +115,7 @@ var tests = []struct {
},
root: _byteArray("7b506db718d5cce819ca4d33d2348065a5408cc89aa8b3f7ac70a0c186a2c81f"),
dot: "digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval];\"Foo\"->1;1 [label=\"7b50…c81f\"];{rank=same;1};}",
sortedRoot: _byteArray("7b506db718d5cce819ca4d33d2348065a5408cc89aa8b3f7ac70a0c186a2c81f"),
sortedPairsRoot: _byteArray("7b506db718d5cce819ca4d33d2348065a5408cc89aa8b3f7ac70a0c186a2c81f"),
sortedLeavesRoot: _byteArray("7b506db718d5cce819ca4d33d2348065a5408cc89aa8b3f7ac70a0c186a2c81f"),
fillDefaultRoot: _byteArray("7b506db718d5cce819ca4d33d2348065a5408cc89aa8b3f7ac70a0c186a2c81f"),
Expand Down Expand Up @@ -143,6 +146,7 @@ var tests = []struct {
"digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval];\"Foo\"->4;4 [label=\"7b50…c81f\" style=filled fillcolor=\"#8080ff\"];4->2;\"Bar\" [shape=oval];\"Bar\"->5;5 [label=\"03c7…6406\" style=filled fillcolor=\"#8080ff\"];4->5 [style=invisible arrowhead=none];5->2;\"Baz\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Baz\"->6;6 [label=\"6d5f…2ae0\" style=filled fillcolor=\"#8080ff\"];5->6 [style=invisible arrowhead=none];6->3;7 [label=\"0000…0000\" style=filled fillcolor=\"#8080ff\"];6->7 [style=invisible arrowhead=none];7->3;{rank=same;4;5;6;7};3 [label=\"113f…1135\" style=filled fillcolor=\"#8080ff\"];3->1;2 [label=\"e9e0…f637\" style=filled fillcolor=\"#8080ff\"];2->1;1 [label=\"2c95…4203\" style=filled fillcolor=\"#8080ff\"];}",
},
},
sortedRoot: _byteArray("104ce76411c01418f66b2c28c16cc46d058bdef4cc31aab09605f46375f5140f"),
sortedPairsRoot: _byteArray("db368764ed9bde4ff75f27403c2e3eb10d03b7757514c886f83337f9667df443"),
sortedLeavesRoot: _byteArray("cf53e43fb79844c5475fad360e7f8096f45396e3c3fecb457ea76e3250d797c6"),
fillDefaultRoot: _byteArray("573cb9effba5c9e1b6d11208bbbf4af154e35c35e18875f8e566b3e3e33c9e85"),
Expand All @@ -169,6 +173,7 @@ var tests = []struct {
},
},
multiProofDot: "digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Foo\"->8;8 [label=\"7b50…c81f\"];8->4;\"Bar\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Bar\"->9;9 [label=\"03c7…6406\"];8->9 [style=invisible arrowhead=none];9->4;\"Baz\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Baz\"->10;10 [label=\"6d5f…2ae0\"];9->10 [style=invisible arrowhead=none];10->5;\"Qux\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Qux\"->11;11 [label=\"d5d1…3cda\"];10->11 [style=invisible arrowhead=none];11->5;\"Quux\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Quux\"->12;12 [label=\"2fec…1151\"];11->12 [style=invisible arrowhead=none];12->6;\"Quuz\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"Quuz\"->13;13 [label=\"aff2…62e5\"];12->13 [style=invisible arrowhead=none];13->6;14 [label=\"0000…0000\"];13->14 [style=invisible arrowhead=none];14->7;15 [label=\"0000…0000\"];14->15 [style=invisible arrowhead=none];15->7;{rank=same;8;9;10;11;12;13;14;15};7 [label=\"0eb9…9761\" style=filled fillcolor=\"#00ff00\"];7->3;6 [label=\"3705…4377\"];6->3;5 [label=\"f277…7fd5\"];5->2;4 [label=\"e9e0…f637\"];4->2;3 [label=\"5082…d5f0\"];3->1;2 [label=\"7799…9592\"];2->1;1 [label=\"9db4…516d\" style=filled fillcolor=\"#8080ff\"];}",
sortedRoot: _byteArray("09c6a1125ab5c95843aa1adbaa21a52d89db5a7cff90cfb6ccc45a0756d7471a"),
sortedPairsRoot: _byteArray("5dbc18f689a37f049f2c84024ddc6d9785fc5b28681d0269a88ec48bba51a8a5"),
sortedLeavesRoot: _byteArray("c0c39b336d8a291d82d42614f6b2fb87522744c28d45225dcc96ad9d932c028f"),
fillDefaultRoot: _byteArray("ad0f50d11ef5fa36618b34d42331481f6865f212b7220b230cb6a50c5a4268cf"),
Expand Down Expand Up @@ -282,6 +287,7 @@ var tests = []struct {
"digraph MerkleTree {rankdir = TB;node [shape=rectangle margin=\"0.2,0.2\"];\"Foo\" [shape=oval];\"Foo\"->16 [label=\"+00000000\"];16 [label=\"2434…cfac\"];16->8;\"Bar\" [shape=oval];\"Bar\"->17 [label=\"+00000001\"];17 [label=\"f40e…406d\"];16->17 [style=invisible arrowhead=none];17->8;\"Baz\" [shape=oval];\"Baz\"->18 [label=\"+00000002\"];18 [label=\"7c7c…5a1c\"];17->18 [style=invisible arrowhead=none];18->9;\"Qux\" [shape=oval];\"Qux\"->19 [label=\"+00000003\"];19 [label=\"b718…ea0d\"];18->19 [style=invisible arrowhead=none];19->9;\"Quux\" [shape=oval];\"Quux\"->20 [label=\"+00000004\"];20 [label=\"be71…083a\"];19->20 [style=invisible arrowhead=none];20->10;\"Quuz\" [shape=oval];\"Quuz\"->21 [label=\"+00000005\"];21 [label=\"73a8…bc0f\"];20->21 [style=invisible arrowhead=none];21->10;\"FooBar\" [shape=oval];\"FooBar\"->22 [label=\"+00000006\"];22 [label=\"e8b3…5f20\"];21->22 [style=invisible arrowhead=none];22->11;\"FooBaz\" [shape=oval];\"FooBaz\"->23 [label=\"+00000007\"];23 [label=\"970f…8911\"];22->23 [style=invisible arrowhead=none];23->11;\"BarBaz\" [shape=oval style=filled fillcolor=\"#ff4040\"];\"BarBaz\"->24 [label=\"+00000008\"];24 [label=\"cb70…bc43\"];23->24 [style=invisible arrowhead=none];24->12;25 [label=\"0000…0000\" style=filled fillcolor=\"#00ff00\"];24->25 [style=invisible arrowhead=none];25->12;26 [label=\"0000…0000\"];25->26 [style=invisible arrowhead=none];26->13;27 [label=\"0000…0000\"];26->27 [style=invisible arrowhead=none];27->13;28 [label=\"0000…0000\"];27->28 [style=invisible arrowhead=none];28->14;29 [label=\"0000…0000\"];28->29 [style=invisible arrowhead=none];29->14;30 [label=\"0000…0000\"];29->30 [style=invisible arrowhead=none];30->15;31 [label=\"0000…0000\"];30->31 [style=invisible arrowhead=none];31->15;{rank=same;16;17;18;19;20;21;22;23;24;25;26;27;28;29;30;31};15 [label=\"0eb9…9761\" style=filled fillcolor=\"#8080ff\"];15->7;14 [label=\"0eb9…9761\" style=filled fillcolor=\"#8080ff\"];14->7;13 [label=\"0eb9…9761\" style=filled fillcolor=\"#8080ff\"];13->6;12 [label=\"e9d0…3bad\" style=filled fillcolor=\"#8080ff\"];12->6;11 [label=\"b3c6…0cd2\" style=filled fillcolor=\"#8080ff\"];11->5;10 [label=\"7473…a3a4\" style=filled fillcolor=\"#8080ff\"];10->5;9 [label=\"6dc5…fd2b\" style=filled fillcolor=\"#8080ff\"];9->4;8 [label=\"8d18…354d\" style=filled fillcolor=\"#8080ff\"];8->4;7 [label=\"85c0…c3b1\" style=filled fillcolor=\"#8080ff\"];7->3;6 [label=\"fb16…ac5b\" style=filled fillcolor=\"#8080ff\"];6->3;5 [label=\"4847…84bf\" style=filled fillcolor=\"#8080ff\"];5->2;4 [label=\"622b…1133\" style=filled fillcolor=\"#8080ff\"];4->2;3 [label=\"ee7e…8174\" style=filled fillcolor=\"#8080ff\"];3->1;2 [label=\"286d…fea8\" style=filled fillcolor=\"#8080ff\"];2->1;1 [label=\"6530…4dbd\" style=filled fillcolor=\"#8080ff\"];}",
},
},
sortedRoot: _byteArray("1427a61627f0a8f0eff691fb26fe94a9b7170669ff45d33f829018c04cd20798"),
sortedPairsRoot: _byteArray("a42c0537b6528c28e10f59cca71493dbbbaf6d9dccbe0bdd61adde5c7aaedb84"),
sortedLeavesRoot: _byteArray("8338f789012f023535c6fbe5fbde4b5cf15eed8176ed7ad72755e61ad8752b3a"),
fillDefaultRoot: _byteArray("304bafafa91d089940c71064530dca4991cf4d7893bfde13c760489ae7df1f70"),
Expand All @@ -296,6 +302,7 @@ var tests = []struct {
dot: `digraph MerkleTree {rankdir = TB;node [shape=rectangle margin="0.2,0.2"];"Foo" [shape=oval];"Foo"->2 [label="+00000000"];2 [label="8cfa…3eb2"];2->1;"Bar" [shape=oval];"Bar"->3 [label="+00000001"];3 [label="3ef4…7217"];2->3 [style=invisible arrowhead=none];3->1;{rank=same;2;3};1 [label="2c43…ac7e"];}`,
salt: true,
saltedRoot: _byteArray("0x2c43852d823852001111584dadcb305a7336ec3f392e4eb81be4664ff2baac7e"),
sortedRoot: _byteArray("bd5d1211ddae4a38d2627d8d31922315d929857541ef40cfa5a3f9696e3bdd35"),
sortedPairsRoot: _byteArray("bd5d1211ddae4a38d2627d8d31922315d929857541ef40cfa5a3f9696e3bdd35"),
sortedLeavesRoot: _byteArray("bd5d1211ddae4a38d2627d8d31922315d929857541ef40cfa5a3f9696e3bdd35"),
fillDefaultRoot: _byteArray("bd5d1211ddae4a38d2627d8d31922315d929857541ef40cfa5a3f9696e3bdd35"),
Expand All @@ -310,6 +317,7 @@ var tests = []struct {
dot: `digraph MerkleTree {rankdir = TB;node [shape=rectangle margin="0.2,0.2"];"Foo" [shape=oval];"Foo"->2 [label="+00000000"];2 [label="f38c…facc"];2->1;"Bar" [shape=oval];"Bar"->3 [label="+00000001"];3 [label="e6ee…2d69"];2->3 [style=invisible arrowhead=none];3->1;{rank=same;2;3};1 [label="9c68…0af8"];}`,
salt: true,
saltedRoot: _byteArray("0x9c68ec06cd268662d643706a29bf697d6873edff158895aee0b33df3ff741bcc17f1886a4a13408588c1428cd1b3455c1c0b800d304cebffb1aeb5941fe50af8"),
sortedRoot: _byteArray("89df6c494d26c15fa85b047ca1d72a0255b3c975d213f9a4d4d4e273415abe6e49132348978bf85c4083c8a1604d7b293c752d725dd35d1b9a94da85b7997cbd"),
sortedPairsRoot: _byteArray("89df6c494d26c15fa85b047ca1d72a0255b3c975d213f9a4d4d4e273415abe6e49132348978bf85c4083c8a1604d7b293c752d725dd35d1b9a94da85b7997cbd"),
sortedLeavesRoot: _byteArray("89df6c494d26c15fa85b047ca1d72a0255b3c975d213f9a4d4d4e273415abe6e49132348978bf85c4083c8a1604d7b293c752d725dd35d1b9a94da85b7997cbd"),
fillDefaultRoot: _byteArray("5383482cf75e1cee1608ff4dd4250ca84ee0e5037dd77fd3fd5243e3955cc8570e90cf5c1043a55f2226011166b5829471e369ac4e535fe135357f8b21fb3c6d"),
Expand Down

0 comments on commit ba681e1

Please sign in to comment.