@@ -3,115 +3,150 @@ pragma solidity 0.8.9;
3
3
4
4
import "forge-std/Test.sol " ;
5
5
6
- import { UnstructuredStorage } from "contracts/0.8.9/lib/UnstructuredStorage.sol " ;
6
+ import {UnstructuredStorage} from "contracts/0.8.9/lib/UnstructuredStorage.sol " ;
7
7
8
8
contract ExposedUnstructuredStorageTest is Test {
9
- ExposedUnstructuredStorage public unstructedStorage ;
9
+ ExposedUnstructuredStorage public unstructuredStorage ;
10
10
11
11
function setUp () public {
12
- unstructedStorage = new ExposedUnstructuredStorage ();
12
+ unstructuredStorage = new ExposedUnstructuredStorage ();
13
13
}
14
14
15
15
function test_getStorageBool_Uninitialized () public {
16
- bytes32 position = keccak256 ("FOO " );
17
- assertEq (unstructedStorage .getStorageBool (position), false );
16
+ bytes32 position = keccak256 ("FOO " );
17
+ assertEq (unstructuredStorage .getStorageBool (position), false );
18
18
}
19
19
20
+ /**
21
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
22
+ * forge-config: default.fuzz.runs = 2048
23
+ * forge-config: default.fuzz.max-test-rejects = 0
24
+ */
20
25
function testFuzz_getStorageBool_Uninitialized (bytes32 position ) public {
21
- assertEq (unstructedStorage .getStorageBool (position), false );
26
+ assertEq (unstructuredStorage .getStorageBool (position), false );
22
27
}
23
28
24
29
function test_getStorageAddress_Uninitialized () public {
25
30
bytes32 position = keccak256 ("FOO " );
26
- assertEq (unstructedStorage .getStorageAddress (position), address (0 ));
31
+ assertEq (unstructuredStorage .getStorageAddress (position), address (0 ));
27
32
}
28
33
29
- function testFuzz_getStorageAddress_Uninitialized (bytes32 position ) public {
30
- assertEq (unstructedStorage.getStorageAddress (position), address (0 ));
34
+ /**
35
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
36
+ * forge-config: default.fuzz.runs = 2048
37
+ * forge-config: default.fuzz.max-test-rejects = 0
38
+ */
39
+ function testFuzz_getStorageAddress_Uninitialized (bytes32 position ) public {
40
+ assertEq (unstructuredStorage.getStorageAddress (position), address (0 ));
31
41
}
32
42
33
43
function test_getStorageBytes32_Uninitialized () public {
34
44
bytes32 position = keccak256 ("FOO " );
35
45
bytes32 data;
36
- assertEq (unstructedStorage .getStorageBytes32 (position), data);
46
+ assertEq (unstructuredStorage .getStorageBytes32 (position), data);
37
47
}
38
48
49
+ /**
50
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
51
+ * forge-config: default.fuzz.runs = 2048
52
+ * forge-config: default.fuzz.max-test-rejects = 0
53
+ */
39
54
function testFuzz_getStorageBytes32_Uninitialized (bytes32 position ) public {
40
55
bytes32 data;
41
- assertEq (unstructedStorage .getStorageBytes32 (position), data);
56
+ assertEq (unstructuredStorage .getStorageBytes32 (position), data);
42
57
}
43
58
44
59
function test_getStorageUint256_Uninitialized () public {
45
60
bytes32 position = keccak256 ("FOO " );
46
61
uint256 data;
47
- assertEq (unstructedStorage .getStorageUint256 (position), data);
62
+ assertEq (unstructuredStorage .getStorageUint256 (position), data);
48
63
}
49
64
65
+ /**
66
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
67
+ * forge-config: default.fuzz.runs = 2048
68
+ * forge-config: default.fuzz.max-test-rejects = 0
69
+ */
50
70
function testFuzz_getStorageUint256_Uninitialized (bytes32 position ) public {
51
71
uint256 data;
52
- assertEq (unstructedStorage .getStorageUint256 (position), data);
72
+ assertEq (unstructuredStorage .getStorageUint256 (position), data);
53
73
}
54
74
55
75
function test_setStorageBool () public {
56
76
bytes32 position = keccak256 ("FOO " );
57
- assertEq (unstructedStorage .getStorageBool (position), false );
77
+ assertEq (unstructuredStorage .getStorageBool (position), false );
58
78
59
- unstructedStorage .setStorageBool (position, true );
60
- assertEq (unstructedStorage .getStorageBool (position), true );
79
+ unstructuredStorage .setStorageBool (position, true );
80
+ assertEq (unstructuredStorage .getStorageBool (position), true );
61
81
62
- unstructedStorage .setStorageBool (position, false );
63
- assertEq (unstructedStorage .getStorageBool (position), false );
82
+ unstructuredStorage .setStorageBool (position, false );
83
+ assertEq (unstructuredStorage .getStorageBool (position), false );
64
84
}
65
85
66
86
function test_setStorageAddress () public {
67
87
bytes32 position = keccak256 ("FOO " );
68
88
address data = vm.addr (1 );
69
89
70
- assertEq (unstructedStorage .getStorageAddress (position), address (0 ));
71
- unstructedStorage .setStorageAddress (position, data);
72
- assertEq (unstructedStorage .getStorageAddress (position), data);
90
+ assertEq (unstructuredStorage .getStorageAddress (position), address (0 ));
91
+ unstructuredStorage .setStorageAddress (position, data);
92
+ assertEq (unstructuredStorage .getStorageAddress (position), data);
73
93
}
74
94
95
+ /**
96
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
97
+ * forge-config: default.fuzz.runs = 2048
98
+ * forge-config: default.fuzz.max-test-rejects = 0
99
+ */
75
100
function testFuzz_setStorageAddress (address data , bytes32 position ) public {
76
- assertEq (unstructedStorage .getStorageAddress (position), address (0 ));
77
- unstructedStorage .setStorageAddress (position, data);
78
- assertEq (unstructedStorage .getStorageAddress (position), data);
101
+ assertEq (unstructuredStorage .getStorageAddress (position), address (0 ));
102
+ unstructuredStorage .setStorageAddress (position, data);
103
+ assertEq (unstructuredStorage .getStorageAddress (position), data);
79
104
}
80
105
81
106
function test_setStorageBytes32 () public {
82
107
bytes32 position = keccak256 ("FOO " );
83
108
bytes32 data = keccak256 ("BAR " );
84
- bytes32 unintializedData ;
109
+ bytes32 unInitializedData ;
85
110
86
- assertEq (unstructedStorage .getStorageBytes32 (position), unintializedData );
87
- unstructedStorage .setStorageBytes32 (position, data);
88
- assertEq (unstructedStorage .getStorageBytes32 (position), data);
111
+ assertEq (unstructuredStorage .getStorageBytes32 (position), unInitializedData );
112
+ unstructuredStorage .setStorageBytes32 (position, data);
113
+ assertEq (unstructuredStorage .getStorageBytes32 (position), data);
89
114
}
90
115
116
+ /**
117
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
118
+ * forge-config: default.fuzz.runs = 2048
119
+ * forge-config: default.fuzz.max-test-rejects = 0
120
+ */
91
121
function testFuzz_setStorageBytes32 (bytes32 data , bytes32 position ) public {
92
- bytes32 unintializedData ;
122
+ bytes32 unInitializedData ;
93
123
94
- assertEq (unstructedStorage .getStorageBytes32 (position), unintializedData );
95
- unstructedStorage .setStorageBytes32 (position, data);
96
- assertEq (unstructedStorage .getStorageBytes32 (position), data);
124
+ assertEq (unstructuredStorage .getStorageBytes32 (position), unInitializedData );
125
+ unstructuredStorage .setStorageBytes32 (position, data);
126
+ assertEq (unstructuredStorage .getStorageBytes32 (position), data);
97
127
}
98
128
99
129
function test_setStorageUint256 () public {
100
130
bytes32 position = keccak256 ("FOO " );
101
131
uint256 data = 1 ;
102
- uint256 unintializedData ;
132
+ uint256 unInitializedData ;
103
133
104
- assertEq (unstructedStorage .getStorageUint256 (position), unintializedData );
105
- unstructedStorage .setStorageUint256 (position, data);
106
- assertEq (unstructedStorage .getStorageUint256 (position), data);
134
+ assertEq (unstructuredStorage .getStorageUint256 (position), unInitializedData );
135
+ unstructuredStorage .setStorageUint256 (position, data);
136
+ assertEq (unstructuredStorage .getStorageUint256 (position), data);
107
137
}
108
138
139
+ /**
140
+ * https://book.getfoundry.sh/reference/config/inline-test-config#in-line-fuzz-configs
141
+ * forge-config: default.fuzz.runs = 2048
142
+ * forge-config: default.fuzz.max-test-rejects = 0
143
+ */
109
144
function testFuzz_setStorageUint256 (uint256 data , bytes32 position ) public {
110
- uint256 unintializedData ;
145
+ uint256 unInitializedData ;
111
146
112
- assertEq (unstructedStorage .getStorageUint256 (position), unintializedData );
113
- unstructedStorage .setStorageUint256 (position, data);
114
- assertEq (unstructedStorage .getStorageUint256 (position), data);
147
+ assertEq (unstructuredStorage .getStorageUint256 (position), unInitializedData );
148
+ unstructuredStorage .setStorageUint256 (position, data);
149
+ assertEq (unstructuredStorage .getStorageUint256 (position), data);
115
150
}
116
151
}
117
152
0 commit comments