diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-19 20:22:58 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-01-19 20:22:58 +0800 |
commit | 6a58db66f7f42a49667bcc751418256441752279 (patch) | |
tree | 58f3e4b5ca956a1389324918d0d5695668720f94 /test/abi.parsers.js | |
parent | af54832d2435ff4116c887effa09e4f276ac970c (diff) | |
download | go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar.gz go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar.bz2 go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar.lz go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar.xz go-tangerine-6a58db66f7f42a49667bcc751418256441752279.tar.zst go-tangerine-6a58db66f7f42a49667bcc751418256441752279.zip |
parsing real, ureal values on output
Diffstat (limited to 'test/abi.parsers.js')
-rw-r--r-- | test/abi.parsers.js | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/test/abi.parsers.js b/test/abi.parsers.js index bbf10bcd3..e9613817b 100644 --- a/test/abi.parsers.js +++ b/test/abi.parsers.js @@ -419,7 +419,6 @@ describe('abi', function() { }); - }); describe('outputParser', function() { @@ -673,11 +672,51 @@ describe('abi', function() { var parser = abi.outputParser(d); // then - assert.equal(parser.test("000000000000000000000000000000000000000000000000000000000000000001")[0], true); - assert.equal(parser.test("000000000000000000000000000000000000000000000000000000000000000000")[0], false); + assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000001")[0], true); + assert.equal(parser.test("0x0000000000000000000000000000000000000000000000000000000000000000")[0], false); + + + }); + + it('should parse output real', function() { + + // given + var d = clone(description); + + d[0].outputs = [ + { type: 'real' } + ]; + + // when + var parser = abi.outputParser(d); + + // then + assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1); + assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125); + assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5); + assert.equal(parser.test("0xffffffffffffffffffffffffffffffff00000000000000000000000000000000")[0], -1); + }); + + it('should parse output ureal', function() { + + // given + var d = clone(description); + + d[0].outputs = [ + { type: 'ureal' } + ]; + + // when + var parser = abi.outputParser(d); + + // then + assert.equal(parser.test("0x0000000000000000000000000000000100000000000000000000000000000000")[0], 1); + assert.equal(parser.test("0x0000000000000000000000000000000220000000000000000000000000000000")[0], 2.125); + assert.equal(parser.test("0x0000000000000000000000000000000880000000000000000000000000000000")[0], 8.5); }); + it('should parse multiple output strings', function() { |