Skip to content

Commit 6aea142

Browse files
added small overflow test
1 parent 08aa8cb commit 6aea142

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

src/test/Spec.hs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{-# LANGUAGE FlexibleContexts #-}
2-
{-# LANGUAGE NamedFieldPuns #-}
32

43
import Test.Tasty (defaultMain, testGroup)
54
import System.Directory (withCurrentDirectory)
@@ -11,6 +10,7 @@ import Tests.Config (configTests)
1110
import Tests.Encoding (encodingJSONTests)
1211
import Tests.Integration (integrationTests)
1312
import Tests.Optimization (optimizationTests)
13+
import Tests.Overflow (overflowTests)
1414
import Tests.Research (researchTests)
1515
import Tests.Values (valuesTests)
1616
import Tests.Seed (seedTests)
@@ -27,6 +27,7 @@ main = withCurrentDirectory "./tests/solidity" . defaultMain $
2727
, coverageTests
2828
, abiv2Tests
2929
, assertionTests
30+
, overflowTests
3031
, optimizationTests
3132
, researchTests
3233
, encodingJSONTests

src/test/Tests/Overflow.hs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module Tests.Overflow (overflowTests) where
2+
3+
import Test.Tasty (TestTree, testGroup)
4+
5+
import Common (testContractV, solcV, solvedUsing)
6+
7+
overflowTests :: TestTree
8+
overflowTests = testGroup "Overflow-based Integration Testing"
9+
[
10+
testContractV "overflow/overflow.sol" (Just (\v -> v >= solcV (0,8,0))) (Just "overflow/config.yaml")
11+
[ ("f passed", solvedUsing "f" "Integer (over/under)flow") ]
12+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
testMode: overflow
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
contract Test {
2+
function f(uint x) public {
3+
type(uint256).max + x;
4+
}
5+
}

0 commit comments

Comments
 (0)