2
2
3
3
pragma solidity ^ 0.8.0 ;
4
4
5
- import {uint48x2, uint48x2From} from "types/uint48x2.sol " ;
6
5
import {Test} from "forge-std/Test.sol " ;
6
+ import {uint48x2, uint48x2From} from "types/uint48x2.sol " ;
7
7
8
8
contract uint48x2Test is Test {
9
- function testAccessors () public pure {
9
+ function testAccessors () external pure {
10
10
uint48x2 pair = uint48x2From (1 , 2 );
11
11
12
12
assertEq (pair.lo (), 2 );
13
13
assertEq (pair.hi (), 1 );
14
14
}
15
15
16
- function testIncDec () public pure {
16
+ function testIncDec () external pure {
17
17
uint48x2 pair = uint48x2From (300 , 500 );
18
18
pair = pair.inc (200 );
19
19
@@ -32,7 +32,7 @@ contract uint48x2Test is Test {
32
32
assert (pair2 == pair3);
33
33
}
34
34
35
- function tesetClear () public pure {
35
+ function tesetClear () external pure {
36
36
uint48x2 i = uint48x2From (2 , 1 );
37
37
38
38
i = i.clearHi ();
@@ -47,7 +47,7 @@ contract uint48x2Test is Test {
47
47
assertEq (j.lo (), 0 );
48
48
}
49
49
50
- function testSum () public pure {
50
+ function testSum () external pure {
51
51
uint48x2 i = uint48x2From (type (uint48 ).max - 1 , 1 );
52
52
53
53
assertEq (i.sum (), type (uint48 ).max);
@@ -56,10 +56,24 @@ contract uint48x2Test is Test {
56
56
assertEq (uint48x2From (1337 , 1338 ).sum (), 2 * 1337 + 1 );
57
57
}
58
58
59
- function testSetLo () public pure {
59
+ function testSetLo () external pure {
60
60
uint48x2 i = uint48x2From (2 , 3 );
61
61
62
62
assertEq (i.setLo (4 ).hi (), 2 );
63
63
assertEq (i.setLo (4 ).lo (), 4 );
64
64
}
65
+
66
+ function testClearLo () external pure {
67
+ uint48x2 n = uint48x2From (3 , 2 ).clearLo ();
68
+
69
+ assertEq (n.hi (), 3 );
70
+ assertEq (n.lo (), 0 );
71
+ }
72
+
73
+ function testClearHi () external pure {
74
+ uint48x2 n = uint48x2From (3 , 2 ).clearHi ();
75
+
76
+ assertEq (n.hi (), 0 );
77
+ assertEq (n.lo (), 2 );
78
+ }
65
79
}
0 commit comments