Commit 27db7ed1 authored by clabby's avatar clabby

Gas snapshot + Lint

parent 91160dc7
...@@ -230,6 +230,7 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10627) ...@@ -230,6 +230,7 @@ LegacyERC20ETH_Test:test_mint_doesNotExist_reverts() (gas: 10627)
LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957) LegacyERC20ETH_Test:test_transferFrom_doesNotExist_reverts() (gas: 12957)
LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755) LegacyERC20ETH_Test:test_transfer_doesNotExist_reverts() (gas: 10755)
LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524) LegacyMessagePasser_Test:test_passMessageToL1_succeeds() (gas: 34524)
LibPosition_Test:test_pos_correctness() (gas: 39343)
MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5736) MerkleTrie_get_Test:test_get_corruptedProof_reverts() (gas: 5736)
MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58975) MerkleTrie_get_Test:test_get_extraProofElements_reverts() (gas: 58975)
MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852) MerkleTrie_get_Test:test_get_invalidDataRemainder_reverts() (gas: 35852)
......
...@@ -158,251 +158,251 @@ contract LibPosition_Test is Test { ...@@ -158,251 +158,251 @@ contract LibPosition_Test is Test {
uint256 maxDepth = 4; uint256 maxDepth = 4;
Position p = LibPosition.wrap(0, 0); Position p = LibPosition.wrap(0, 0);
assertEq(Position.unwrap(p), 1); // gindex = 1 assertEq(Position.unwrap(p), 1); // gindex = 1
assertEq(p.depth(), 0); // depth = 0 assertEq(p.depth(), 0); // depth = 0
assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0 assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0
Position r = p.rightIndex(maxDepth); Position r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 31); // right gindex = 31 assertEq(Position.unwrap(r), 31); // right gindex = 31
assertEq(r.indexAtDepth(), 15); // trace index = 15 assertEq(r.indexAtDepth(), 15); // trace index = 15
p = LibPosition.wrap(1, 0); p = LibPosition.wrap(1, 0);
assertEq(Position.unwrap(p), 2); // gindex = 2 assertEq(Position.unwrap(p), 2); // gindex = 2
assertEq(p.depth(), 1); // depth = 1 assertEq(p.depth(), 1); // depth = 1
assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0 assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 23); // right gindex = 23 assertEq(Position.unwrap(r), 23); // right gindex = 23
assertEq(r.indexAtDepth(), 7); // trace index = 7 assertEq(r.indexAtDepth(), 7); // trace index = 7
p = LibPosition.wrap(1, 1); p = LibPosition.wrap(1, 1);
assertEq(Position.unwrap(p), 3); // gindex = 3 assertEq(Position.unwrap(p), 3); // gindex = 3
assertEq(p.depth(), 1); // depth = 1 assertEq(p.depth(), 1); // depth = 1
assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1 assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 31); // right gindex = 31 assertEq(Position.unwrap(r), 31); // right gindex = 31
assertEq(r.indexAtDepth(), 15); // trace index = 15 assertEq(r.indexAtDepth(), 15); // trace index = 15
p = LibPosition.wrap(2, 0); p = LibPosition.wrap(2, 0);
assertEq(Position.unwrap(p), 4); // gindex = 4 assertEq(Position.unwrap(p), 4); // gindex = 4
assertEq(p.depth(), 2); // depth = 2 assertEq(p.depth(), 2); // depth = 2
assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0 assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 19); // right gindex = 19 assertEq(Position.unwrap(r), 19); // right gindex = 19
assertEq(r.indexAtDepth(), 3); // trace index = 3 assertEq(r.indexAtDepth(), 3); // trace index = 3
p = LibPosition.wrap(2, 1); p = LibPosition.wrap(2, 1);
assertEq(Position.unwrap(p), 5); // gindex = 5 assertEq(Position.unwrap(p), 5); // gindex = 5
assertEq(p.depth(), 2); // depth = 2 assertEq(p.depth(), 2); // depth = 2
assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1 assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 23); // right gindex = 23 assertEq(Position.unwrap(r), 23); // right gindex = 23
assertEq(r.indexAtDepth(), 7); // trace index = 7 assertEq(r.indexAtDepth(), 7); // trace index = 7
p = LibPosition.wrap(2, 2); p = LibPosition.wrap(2, 2);
assertEq(Position.unwrap(p), 6); // gindex = 6 assertEq(Position.unwrap(p), 6); // gindex = 6
assertEq(p.depth(), 2); // depth = 2 assertEq(p.depth(), 2); // depth = 2
assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2 assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 27); // right gindex = 27 assertEq(Position.unwrap(r), 27); // right gindex = 27
assertEq(r.indexAtDepth(), 11); // trace index = 11 assertEq(r.indexAtDepth(), 11); // trace index = 11
p = LibPosition.wrap(2, 3); p = LibPosition.wrap(2, 3);
assertEq(Position.unwrap(p), 7); // gindex = 7 assertEq(Position.unwrap(p), 7); // gindex = 7
assertEq(p.depth(), 2); // depth = 2 assertEq(p.depth(), 2); // depth = 2
assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3 assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 31); // right gindex = 31 assertEq(Position.unwrap(r), 31); // right gindex = 31
assertEq(r.indexAtDepth(), 15); // trace index = 15 assertEq(r.indexAtDepth(), 15); // trace index = 15
p = LibPosition.wrap(3, 0); p = LibPosition.wrap(3, 0);
assertEq(Position.unwrap(p), 8); // gindex = 8 assertEq(Position.unwrap(p), 8); // gindex = 8
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0 assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 17); // right gindex = 17 assertEq(Position.unwrap(r), 17); // right gindex = 17
assertEq(r.indexAtDepth(), 1); // trace index = 1 assertEq(r.indexAtDepth(), 1); // trace index = 1
p = LibPosition.wrap(3, 1); p = LibPosition.wrap(3, 1);
assertEq(Position.unwrap(p), 9); // gindex = 9 assertEq(Position.unwrap(p), 9); // gindex = 9
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1 assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 19); // right gindex = 19 assertEq(Position.unwrap(r), 19); // right gindex = 19
assertEq(r.indexAtDepth(), 3); // trace index = 3 assertEq(r.indexAtDepth(), 3); // trace index = 3
p = LibPosition.wrap(3, 2); p = LibPosition.wrap(3, 2);
assertEq(Position.unwrap(p), 10); // gindex = 10 assertEq(Position.unwrap(p), 10); // gindex = 10
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2 assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 21); // right gindex = 21 assertEq(Position.unwrap(r), 21); // right gindex = 21
assertEq(r.indexAtDepth(), 5); // trace index = 5 assertEq(r.indexAtDepth(), 5); // trace index = 5
p = LibPosition.wrap(3, 3); p = LibPosition.wrap(3, 3);
assertEq(Position.unwrap(p), 11); // gindex = 11 assertEq(Position.unwrap(p), 11); // gindex = 11
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3 assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 23); // right gindex = 23 assertEq(Position.unwrap(r), 23); // right gindex = 23
assertEq(r.indexAtDepth(), 7); // trace index = 7 assertEq(r.indexAtDepth(), 7); // trace index = 7
p = LibPosition.wrap(3, 4); p = LibPosition.wrap(3, 4);
assertEq(Position.unwrap(p), 12); // gindex = 12 assertEq(Position.unwrap(p), 12); // gindex = 12
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 4); // indexAtDepth = 4 assertEq(p.indexAtDepth(), 4); // indexAtDepth = 4
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 25); // right gindex = 25 assertEq(Position.unwrap(r), 25); // right gindex = 25
assertEq(r.indexAtDepth(), 9); // trace index = 9 assertEq(r.indexAtDepth(), 9); // trace index = 9
p = LibPosition.wrap(3, 5); p = LibPosition.wrap(3, 5);
assertEq(Position.unwrap(p), 13); // gindex = 13 assertEq(Position.unwrap(p), 13); // gindex = 13
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 5); // indexAtDepth = 5 assertEq(p.indexAtDepth(), 5); // indexAtDepth = 5
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 27); // right gindex = 27 assertEq(Position.unwrap(r), 27); // right gindex = 27
assertEq(r.indexAtDepth(), 11); // trace index = 11 assertEq(r.indexAtDepth(), 11); // trace index = 11
p = LibPosition.wrap(3, 6); p = LibPosition.wrap(3, 6);
assertEq(Position.unwrap(p), 14); // gindex = 14 assertEq(Position.unwrap(p), 14); // gindex = 14
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 6); // indexAtDepth = 6 assertEq(p.indexAtDepth(), 6); // indexAtDepth = 6
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 29); // right gindex = 29 assertEq(Position.unwrap(r), 29); // right gindex = 29
assertEq(r.indexAtDepth(), 13); // trace index = 13 assertEq(r.indexAtDepth(), 13); // trace index = 13
p = LibPosition.wrap(3, 7); p = LibPosition.wrap(3, 7);
assertEq(Position.unwrap(p), 15); // gindex = 15 assertEq(Position.unwrap(p), 15); // gindex = 15
assertEq(p.depth(), 3); // depth = 3 assertEq(p.depth(), 3); // depth = 3
assertEq(p.indexAtDepth(), 7); // indexAtDepth = 7 assertEq(p.indexAtDepth(), 7); // indexAtDepth = 7
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 31); // right gindex = 31 assertEq(Position.unwrap(r), 31); // right gindex = 31
assertEq(r.indexAtDepth(), 15); // trace index = 15 assertEq(r.indexAtDepth(), 15); // trace index = 15
p = LibPosition.wrap(4, 0); p = LibPosition.wrap(4, 0);
assertEq(Position.unwrap(p), 16); // gindex = 16 assertEq(Position.unwrap(p), 16); // gindex = 16
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0 assertEq(p.indexAtDepth(), 0); // indexAtDepth = 0
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 16); // right gindex = 16 assertEq(Position.unwrap(r), 16); // right gindex = 16
assertEq(r.indexAtDepth(), 0); // trace index = 0 assertEq(r.indexAtDepth(), 0); // trace index = 0
p = LibPosition.wrap(4, 1); p = LibPosition.wrap(4, 1);
assertEq(Position.unwrap(p), 17); // gindex = 17 assertEq(Position.unwrap(p), 17); // gindex = 17
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1 assertEq(p.indexAtDepth(), 1); // indexAtDepth = 1
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 17); // right gindex = 17 assertEq(Position.unwrap(r), 17); // right gindex = 17
assertEq(r.indexAtDepth(), 1); // trace index = 1 assertEq(r.indexAtDepth(), 1); // trace index = 1
p = LibPosition.wrap(4, 2); p = LibPosition.wrap(4, 2);
assertEq(Position.unwrap(p), 18); // gindex = 18 assertEq(Position.unwrap(p), 18); // gindex = 18
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2 assertEq(p.indexAtDepth(), 2); // indexAtDepth = 2
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 18); // right gindex = 18 assertEq(Position.unwrap(r), 18); // right gindex = 18
assertEq(r.indexAtDepth(), 2); // trace index = 2 assertEq(r.indexAtDepth(), 2); // trace index = 2
p = LibPosition.wrap(4, 3); p = LibPosition.wrap(4, 3);
assertEq(Position.unwrap(p), 19); // gindex = 19 assertEq(Position.unwrap(p), 19); // gindex = 19
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3 assertEq(p.indexAtDepth(), 3); // indexAtDepth = 3
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 19); // right gindex = 19 assertEq(Position.unwrap(r), 19); // right gindex = 19
assertEq(r.indexAtDepth(), 3); // trace index = 3 assertEq(r.indexAtDepth(), 3); // trace index = 3
p = LibPosition.wrap(4, 4); p = LibPosition.wrap(4, 4);
assertEq(Position.unwrap(p), 20); // gindex = 20 assertEq(Position.unwrap(p), 20); // gindex = 20
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 4); // indexAtDepth = 4 assertEq(p.indexAtDepth(), 4); // indexAtDepth = 4
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 20); // right gindex = 20 assertEq(Position.unwrap(r), 20); // right gindex = 20
assertEq(r.indexAtDepth(), 4); // trace index = 4 assertEq(r.indexAtDepth(), 4); // trace index = 4
p = LibPosition.wrap(4, 5); p = LibPosition.wrap(4, 5);
assertEq(Position.unwrap(p), 21); // gindex = 21 assertEq(Position.unwrap(p), 21); // gindex = 21
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 5); // indexAtDepth = 5 assertEq(p.indexAtDepth(), 5); // indexAtDepth = 5
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 21); // right gindex = 21 assertEq(Position.unwrap(r), 21); // right gindex = 21
assertEq(r.indexAtDepth(), 5); // trace index = 5 assertEq(r.indexAtDepth(), 5); // trace index = 5
p = LibPosition.wrap(4, 6); p = LibPosition.wrap(4, 6);
assertEq(Position.unwrap(p), 22); // gindex = 22 assertEq(Position.unwrap(p), 22); // gindex = 22
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 6); // indexAtDepth = 6 assertEq(p.indexAtDepth(), 6); // indexAtDepth = 6
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 22); // right gindex = 22 assertEq(Position.unwrap(r), 22); // right gindex = 22
assertEq(r.indexAtDepth(), 6); // trace index = 6 assertEq(r.indexAtDepth(), 6); // trace index = 6
p = LibPosition.wrap(4, 7); p = LibPosition.wrap(4, 7);
assertEq(Position.unwrap(p), 23); // gindex = 23 assertEq(Position.unwrap(p), 23); // gindex = 23
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 7); // indexAtDepth = 7 assertEq(p.indexAtDepth(), 7); // indexAtDepth = 7
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 23); // right gindex = 23 assertEq(Position.unwrap(r), 23); // right gindex = 23
assertEq(r.indexAtDepth(), 7); // trace index = 7 assertEq(r.indexAtDepth(), 7); // trace index = 7
p = LibPosition.wrap(4, 8); p = LibPosition.wrap(4, 8);
assertEq(Position.unwrap(p), 24); // gindex = 24 assertEq(Position.unwrap(p), 24); // gindex = 24
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 8); // indexAtDepth = 8 assertEq(p.indexAtDepth(), 8); // indexAtDepth = 8
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 24); // right gindex = 24 assertEq(Position.unwrap(r), 24); // right gindex = 24
assertEq(r.indexAtDepth(), 8); // trace index = 8 assertEq(r.indexAtDepth(), 8); // trace index = 8
p = LibPosition.wrap(4, 9); p = LibPosition.wrap(4, 9);
assertEq(Position.unwrap(p), 25); // gindex = 25 assertEq(Position.unwrap(p), 25); // gindex = 25
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 9); // indexAtDepth = 9 assertEq(p.indexAtDepth(), 9); // indexAtDepth = 9
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 25); // right gindex = 25 assertEq(Position.unwrap(r), 25); // right gindex = 25
assertEq(r.indexAtDepth(), 9); // trace index = 9 assertEq(r.indexAtDepth(), 9); // trace index = 9
p = LibPosition.wrap(4, 10); p = LibPosition.wrap(4, 10);
assertEq(Position.unwrap(p), 26); // gindex = 26 assertEq(Position.unwrap(p), 26); // gindex = 26
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 10); // indexAtDepth = 10 assertEq(p.indexAtDepth(), 10); // indexAtDepth = 10
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 26); // right gindex = 26 assertEq(Position.unwrap(r), 26); // right gindex = 26
assertEq(r.indexAtDepth(), 10); // trace index = 10 assertEq(r.indexAtDepth(), 10); // trace index = 10
p = LibPosition.wrap(4, 11); p = LibPosition.wrap(4, 11);
assertEq(Position.unwrap(p), 27); // gindex = 27 assertEq(Position.unwrap(p), 27); // gindex = 27
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 11); // indexAtDepth = 11 assertEq(p.indexAtDepth(), 11); // indexAtDepth = 11
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 27); // right gindex = 27 assertEq(Position.unwrap(r), 27); // right gindex = 27
assertEq(r.indexAtDepth(), 11); // trace index = 11 assertEq(r.indexAtDepth(), 11); // trace index = 11
p = LibPosition.wrap(4, 12); p = LibPosition.wrap(4, 12);
assertEq(Position.unwrap(p), 28); // gindex = 28 assertEq(Position.unwrap(p), 28); // gindex = 28
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 12); // indexAtDepth = 12 assertEq(p.indexAtDepth(), 12); // indexAtDepth = 12
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 28); // right gindex = 28 assertEq(Position.unwrap(r), 28); // right gindex = 28
assertEq(r.indexAtDepth(), 12); // trace index = 12 assertEq(r.indexAtDepth(), 12); // trace index = 12
p = LibPosition.wrap(4, 13); p = LibPosition.wrap(4, 13);
assertEq(Position.unwrap(p), 29); // gindex = 29 assertEq(Position.unwrap(p), 29); // gindex = 29
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 13); // indexAtDepth = 13 assertEq(p.indexAtDepth(), 13); // indexAtDepth = 13
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 29); // right gindex = 29 assertEq(Position.unwrap(r), 29); // right gindex = 29
assertEq(r.indexAtDepth(), 13); // trace index = 13 assertEq(r.indexAtDepth(), 13); // trace index = 13
p = LibPosition.wrap(4, 14); p = LibPosition.wrap(4, 14);
assertEq(Position.unwrap(p), 30); // gindex = 30 assertEq(Position.unwrap(p), 30); // gindex = 30
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 14); // indexAtDepth = 14 assertEq(p.indexAtDepth(), 14); // indexAtDepth = 14
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 30); // right gindex = 30 assertEq(Position.unwrap(r), 30); // right gindex = 30
assertEq(r.indexAtDepth(), 14); // trace index = 14 assertEq(r.indexAtDepth(), 14); // trace index = 14
p = LibPosition.wrap(4, 15); p = LibPosition.wrap(4, 15);
assertEq(Position.unwrap(p), 31); // gindex = 31 assertEq(Position.unwrap(p), 31); // gindex = 31
assertEq(p.depth(), 4); // depth = 4 assertEq(p.depth(), 4); // depth = 4
assertEq(p.indexAtDepth(), 15); // indexAtDepth = 15 assertEq(p.indexAtDepth(), 15); // indexAtDepth = 15
r = p.rightIndex(maxDepth); r = p.rightIndex(maxDepth);
assertEq(Position.unwrap(r), 31); // right gindex = 31 assertEq(Position.unwrap(r), 31); // right gindex = 31
assertEq(r.indexAtDepth(), 15); // trace index = 15 assertEq(r.indexAtDepth(), 15); // trace index = 15
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment