From 939caeec467491b7ddb7d3e5a3dcd248e2918775 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sun, 7 Aug 2016 03:16:42 +0300 Subject: [PATCH] Testcase fixes for opcode reworks --- tests/api/test-dump-load-basic.c | 4 +- .../test-bug-fromcharcode-argcount.js | 77 +++++++++---------- tests/ecmascript/test-dev-duk-harray.js | 6 +- 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/tests/api/test-dump-load-basic.c b/tests/api/test-dump-load-basic.c index c5a4108a..2a3d4cf0 100644 --- a/tests/api/test-dump-load-basic.c +++ b/tests/api/test-dump-load-basic.c @@ -40,7 +40,7 @@ /*=== *** test_basic (duk_safe_call) dump result type: 7 -ff000000000e000000030000000100090000000000010000000130000980000000f300400052000040c200000114000101400001414c800041c38000820301014030000141000000814201804030000040000000006f00000000057072696e74000000000568656c6c6f0140091eb851eb851f000000030000000000000000000300020000000100000001300c08800080009a0000806f0000002f000000020000000561646465720000000f66616b6546696c656e616d652e6a730000000d03000000010000000c000000000000000178000000000000000179000000010000000000000001780000000179000000000000000000000006676c6f62616c0000000f66616b6546696c656e616d652e6a730000000e0e000000010000000c00000000000000000000000000 +ff000000000e000000030000000100090000000000010000000130000980000000f300400052000040c200000114000101400001414c800041c380008203000140b00001410000008142000040f0000040000000006f00000000057072696e74000000000568656c6c6f0140091eb851eb851f000000030000000000000000000300020000000100000001300c08800080009a0000806f0000002f000000020000000561646465720000000f66616b6546696c656e616d652e6a730000000d03000000010000000c000000000000000178000000000000000179000000010000000000000001780000000179000000000000000000000006676c6f62616c0000000f66616b6546696c656e616d652e6a730000000e0e000000010000000c00000000000000000000000000 load result type: 6 hello 3 3.14 call result type: 1 @@ -93,7 +93,7 @@ static duk_ret_t test_basic(duk_context *ctx, void *udata) { /*=== *** test_mandel (duk_safe_call) Mandelbrot source length: 884 -ff000000005c000000100000000000130000000000010000001e300c0980801300038007004380190083000008338000156e8000016e800000c30080c3ab0003802d800000ee800013ee0000c3b67ffffeae0080c39d8003839c8083821b0000483380000fee800001ee800001030004023300040340000103ab0003802d800000ee80000dee000103b67ffffeae0001039d8103839c818381db0000883380000a6e8000022e80000143800002438000028300010182010143ab0003802d800000ee8000082e000143b67ffffeae048242dc0502831c0602c39a828383ab0003806d800001ae04c0c39c0503839c0403829a0602c39b0383825a7ffffcae810143ab0003806d800000ae000181828000036e838143ab0003806d800000ae000201828000022e848143ab0003806d800000ae00028182800000ee0002c1828000006e7ffff82e0000887300034380000303c20783839800018400008380307ffff26e00004873004343920003440000038442088404180003c48200840030008380307fffec6e000008730000002f014004000000000000013ff400000000000001400800000000000001400000000000000000000000012301401000000000000000000000012e01401400000000000000000000012c01402400000000000000000000012d00000000013d00000000047075736800000000057072696e7400000000046a6f696e000000000000000000000000066d616e64656c000000096d616e64656c2e6a73000000285c000000020000001400000013000000210000002880201001008004244108910080844a02100420000000017700000000000000016800000001000000046974657200000002000000016900000003000000016a00000004000000016b000000050000000163000000060000000278300000000700000002793000000008000000027878000000090000000279790000000a000000037878320000000b000000037979320000000c000000046c696e650000000d0000000000000000 +ff000000005a000000100000000000130000000000010000001e300c098080130003800700438019008300000833800014ee8000016e800000c30080c3ab0003802d800000ee8000136e0000c3b67ffffeae0080c39d8003839c8083821b0000483380000fae800001ee800001030004023300040340000103ab0003802d800000ee80000dae000103b67ffffeae0001039d8103839c818381db0000883380000a6e8000022e80000143800002438000028300010182010143ab0003802d800000ee8000082e000143b67ffffeae048242dc0502831c0602c39a828383ab0003806d800001ae04c0c39c0503839c0403829a0602c39b0383825a7ffffcae810143ab0003806d800000ae000181828000036e838143ab0003806d800000ae000201828000022e848143ab0003806d800000ae00028182800000ee0002c1828000006e7ffff82e00008873000343c08603439500018400000380707ffff2ae000048730043439200034440870344150003c48200040070000380707fffecee000008730000002f014004000000000000013ff400000000000001400800000000000001400000000000000000000000012301401000000000000000000000012e01401400000000000000000000012c01402400000000000000000000012d00000000013d00000000047075736800000000057072696e7400000000046a6f696e000000000000000000000000066d616e64656c000000096d616e64656c2e6a73000000285a000000020000001400000013000000210000002880201001008004244108910080844a04201080000000017700000000000000016800000001000000046974657200000002000000016900000003000000016a00000004000000016b000000050000000163000000060000000278300000000700000002793000000008000000027878000000090000000279790000000a000000037878320000000b000000037979320000000c000000046c696e650000000d0000000000000000 ..........................,,,,,,,,,,,,,,,,,,,,,,,,,......................... ....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................... ................,,,,,,,,,,,,,,,,,,,,,,,,,,,---=----,,,,,,,,,,............... diff --git a/tests/ecmascript/test-bug-fromcharcode-argcount.js b/tests/ecmascript/test-bug-fromcharcode-argcount.js index 21ec65f8..4e40561a 100644 --- a/tests/ecmascript/test-bug-fromcharcode-argcount.js +++ b/tests/ecmascript/test-bug-fromcharcode-argcount.js @@ -1,51 +1,46 @@ /*=== -300 -ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ +250 +ABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJABCDEFGHIJ +RangeError ===*/ -/* This currently fails due to Duktape register count limits; the failure is - * not specific to String.fromCharCode(). However, String.fromCharCode() is - * an example of a function which could conceivably be used with a lot of - * arguments, to build a large Unicode string. - */ +function test(count) { + var src = []; + var i; + src.push('String.fromCharCode('); + for (i = 0; i < count; i++) { + if (i > 0) { + src.push(','); + } + src.push(String(65 + (i % 10))); + } + src.push(')'); + return eval(src.join('')); +} try { var t; - t = String.fromCharCode( - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74); // 300 args + try { + t = test(250); + print(t.length); + print(t); + } catch (e) { + print(e.name); + } - print(t.length); - print(t); + /* This currently fails due to Duktape register count limits; the failure is + * not specific to String.fromCharCode(). However, String.fromCharCode() is + * an example of a function which could conceivably be used with a lot of + * arguments, to build a large Unicode string. + */ + try { + t = test(300); + print(t.length); + print(t); + } catch (e) { + print(e.name); + } } catch (e) { - print(e); + print(e.stack || e); } diff --git a/tests/ecmascript/test-dev-duk-harray.js b/tests/ecmascript/test-dev-duk-harray.js index 38c3c854..68695ea2 100644 --- a/tests/ecmascript/test-dev-duk-harray.js +++ b/tests/ecmascript/test-dev-duk-harray.js @@ -31,7 +31,7 @@ array constructor test 10 [null,null,null,null,null,"foo",null,null,null,null] 6 [1,2,3,"foo","bar","quux"] 6 [1,2,3,"foo","bar","baz"] -256 +255 ===*/ function arrayConstructorTest() { @@ -58,7 +58,7 @@ function arrayConstructorTest() { // Create Array with a lot of initializer arguments (more than value stack reserve). arr = new Array( - // 256 + // 255 is the current maximum arg count 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, @@ -74,7 +74,7 @@ function arrayConstructorTest() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ); print(arr.length); }