diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/externalTests.sh | 38 | ||||
-rw-r--r-- | test/libjulia/Simplifier.cpp | 12 |
2 files changed, 40 insertions, 10 deletions
diff --git a/test/externalTests.sh b/test/externalTests.sh index 11972eae..2a5ff7ef 100755 --- a/test/externalTests.sh +++ b/test/externalTests.sh @@ -36,14 +36,32 @@ fi SOLJSON="$1" -DIR=$(mktemp -d) -( - echo "Running Zeppelin tests..." - git clone --depth 1 https://github.com/OpenZeppelin/zeppelin-solidity.git "$DIR" - cd "$DIR" - npm install - find . -name soljson.js -exec cp "$SOLJSON" {} \; +function test_truffle +{ + name="$1" + repo="$2" + echo "Running $name tests..." + DIR=$(mktemp -d) + ( + git clone --depth 1 "$repo" "$DIR" + cd "$DIR" + npm install + find . -name soljson.js -exec cp "$SOLJSON" {} \; + if [ "$name" == "Zeppelin" ]; then + # Fix some things that look like bugs (only seemed to fail on Node 6 and not Node 8) + # FIXME: report upstream or to web3.js? + sed -i -e 's/let token = await ERC827TokenMock.new();//;' test/token/ERC827/ERC827Token.js + sed -i -e 's/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0)/CappedCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address)/' test/crowdsale/CappedCrowdsale.test.js + sed -i -e 's/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, { from: owner })/RefundableCrowdsale.new(this.startTime, this.endTime, rate, wallet, 0, this.token.address, { from: owner })/' test/crowdsale/RefundableCrowdsale.test.js + fi + if [ "$name" == "Gnosis" ]; then + # Replace fixed-version pragmas in Gnosis (part of Consensys best practice) + find contracts test -name '*.sol' -type f -print0 | xargs -0 sed -i -e 's/pragma solidity 0/pragma solidity ^0/' + fi + npm run test + ) + rm -rf "$DIR" +} - npm run test -) -rm -rf "$DIR" +test_truffle Gnosis https://github.com/gnosis/gnosis-contracts.git +test_truffle Zeppelin https://github.com/OpenZeppelin/zeppelin-solidity.git diff --git a/test/libjulia/Simplifier.cpp b/test/libjulia/Simplifier.cpp index b48d45c8..4d4e8d53 100644 --- a/test/libjulia/Simplifier.cpp +++ b/test/libjulia/Simplifier.cpp @@ -127,4 +127,16 @@ BOOST_AUTO_TEST_CASE(inside_for) ); } +BOOST_AUTO_TEST_CASE(mod_and) +{ + CHECK( + "{ mstore(0, mod(calldataload(0), exp(2, 8))) }", + "{ mstore(0, and(calldataload(0), 255)) }" + ); + CHECK( + "{ mstore(0, mod(calldataload(0), exp(2, 255))) }", + "{ mstore(0, and(calldataload(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)) }" + ); +} + BOOST_AUTO_TEST_SUITE_END() |