Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 04c196b

Browse files
author
Jan Xie
committed
Merge pull request #340 from rubensayshi/ripemd160-unittest
ripemd160 unittest
2 parents be56376 + 9d95be9 commit 04c196b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ethereum/tests/test_contracts.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,25 @@ def test_sha256():
12391239
0xb393978842a0fa3d3e1470196f098f473f9678e72463cb65ec4ab5581856c2e4 - 2 ** 256
12401240
]
12411241

1242+
1243+
ripemd160_code = """
1244+
def main():
1245+
return([ripemd160(0, chars=0), ripemd160(3), ripemd160(text("doge"), chars=3), ripemd160(text("dog"):str), ripemd160([0,0,0,0,0]:arr), ripemd160([0,0,0,0,0,0], items=5)]:arr)
1246+
"""
1247+
1248+
1249+
def test_ripemd160():
1250+
s = tester.state()
1251+
c = s.abi_contract(ripemd160_code)
1252+
assert c.main() == [
1253+
0x9c1185a5c5e9fc54612808977ee8f548b2258d31,
1254+
0x44d90e2d3714c8663b632fcf0f9d5f22192cc4c8,
1255+
0x2a5756a3da3bc6e4c66a65028f43d31a1290bb75,
1256+
0x2a5756a3da3bc6e4c66a65028f43d31a1290bb75,
1257+
0x9164cab7f680fd7a790080f2e76e049811074349,
1258+
0x9164cab7f680fd7a790080f2e76e049811074349]
1259+
1260+
12421261
sha3_code = """
12431262
def main():
12441263
return([sha3(0, chars=0), sha3(3), sha3(text("doge"), chars=3), sha3(text("dog"):str), sha3([0,0,0,0,0]:arr), sha3([0,0,0,0,0,0], items=5)]:arr)

0 commit comments

Comments
 (0)