-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathTotalPrice.t.sol
29 lines (23 loc) · 962 Bytes
/
TotalPrice.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// SPDX-License-Identifier: AGPL-3.0
pragma solidity >=0.8.0 <0.9.0;
import "../src/TotalPrice.sol";
/// @custom:halmos --solver-timeout-assertion 0
contract TotalPriceTest {
TotalPrice target;
function setUp() public {
target = new TotalPrice();
}
function check_totalPriceBuggy(uint96 price, uint32 quantity) public view {
uint128 total = target.totalPriceBuggy(price, quantity);
assert(quantity == 0 || total >= price);
}
function check_totalPriceFixed(uint96 price, uint32 quantity) public view {
uint128 total = target.totalPriceFixed(price, quantity);
assert(quantity == 0 || total >= price);
}
function check_eq_totalPriceFixed_totalPriceConservative(uint96 price, uint32 quantity) public view {
uint128 total1 = target.totalPriceFixed(price, quantity);
uint128 total2 = target.totalPriceConservative(price, quantity);
assert(total1 == total2);
}
}