File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -165,18 +165,19 @@ contract TrimmingTest is Test {
165
165
uint8 fromDecimals ,
166
166
uint8 toDecimals
167
167
) public {
168
- // this is guaranteed by trimming
169
168
uint256 amt = bound (amount, 1 , type (uint64 ).max);
170
- vm.assume (fromDecimals <= 18 );
171
- vm.assume (toDecimals <= 18 );
169
+ vm.assume (fromDecimals <= 50 );
170
+ vm.assume (toDecimals <= 50 );
172
171
173
- // trimming
174
- uint8 initialDecimals = 0 ;
175
- TrimmedAmount memory trimmedAmount = TrimmedAmount (uint64 (amt), initialDecimals);
172
+ // NOTE: this is guaranteeed by trimming
173
+ vm.assume (fromDecimals <= 8 && fromDecimals <= toDecimals);
174
+
175
+ // initialize TrimmedAmount
176
+ TrimmedAmount memory trimmedAmount = TrimmedAmount (uint64 (amt), fromDecimals);
176
177
177
178
// trimming is left inverse of trimming
178
- uint256 amountUntrimmed = trimmedAmount.untrim (fromDecimals );
179
- TrimmedAmount memory amountRoundTrip = amountUntrimmed.trim (fromDecimals, initialDecimals );
179
+ uint256 amountUntrimmed = trimmedAmount.untrim (toDecimals );
180
+ TrimmedAmount memory amountRoundTrip = amountUntrimmed.trim (toDecimals, fromDecimals );
180
181
181
182
assertEq (trimmedAmount.amount, amountRoundTrip.amount);
182
183
}
You can’t perform that action at this time.
0 commit comments