Skip to content

Commit

Permalink
test: fuzz testNegativeAnswer
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Oct 4, 2023
1 parent 0564ee9 commit 0c07aa2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/chainlink/Oracle2Test.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ contract OracleTest is Test {
assertApproxEqRel(oracle.price(), 1e36 / 1e6, 0.01 ether);
}

function testNegativeAnswer() public {
function testNegativeAnswer(int price) public {
vm.assume(price < 0);
FakeAggregator aggregator = new FakeAggregator();
Oracle2 oracle =
new Oracle2(AggregatorV3Interface(address(aggregator)), AggregatorV3Interface(address(0)), 18, 0);
aggregator.setAnwser(-1);
aggregator.setAnwser(price);
vm.expectRevert(bytes(ErrorsLib.NEGATIVE_ANSWER));
oracle.price();
}
Expand Down

0 comments on commit 0c07aa2

Please sign in to comment.