From 0c07aa26879b8e3d24adf93455d7c50806c893c4 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Wed, 4 Oct 2023 10:15:14 +0200 Subject: [PATCH] test: fuzz testNegativeAnswer --- test/chainlink/Oracle2Test.sol | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/chainlink/Oracle2Test.sol b/test/chainlink/Oracle2Test.sol index a9966d3..740faca 100644 --- a/test/chainlink/Oracle2Test.sol +++ b/test/chainlink/Oracle2Test.sol @@ -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(); }