Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | var typedSwitch0 = function (a) { |
michael@0 | 2 | switch (a) { |
michael@0 | 3 | case null: |
michael@0 | 4 | return 0; |
michael@0 | 5 | case 1.1: |
michael@0 | 6 | return 1; |
michael@0 | 7 | case "2": |
michael@0 | 8 | return 2; |
michael@0 | 9 | case 3: |
michael@0 | 10 | return 3; |
michael@0 | 11 | } |
michael@0 | 12 | return 4; |
michael@0 | 13 | }; |
michael@0 | 14 | |
michael@0 | 15 | // reuse the same function for testing with different inputs & type. |
michael@0 | 16 | var typedSwitch1 = eval(typedSwitch0.toSource()); |
michael@0 | 17 | var typedSwitch2 = eval(typedSwitch0.toSource()); |
michael@0 | 18 | var typedSwitch3 = eval(typedSwitch0.toSource()); |
michael@0 | 19 | var typedSwitch4 = eval(typedSwitch0.toSource()); |
michael@0 | 20 | |
michael@0 | 21 | for (var i = 0; i < 100; i++) { |
michael@0 | 22 | assertEq(typedSwitch0(null), 0); |
michael@0 | 23 | assertEq(typedSwitch1(1.1), 1); |
michael@0 | 24 | assertEq(typedSwitch2("2"), 2); |
michael@0 | 25 | assertEq(typedSwitch3(3), 3); |
michael@0 | 26 | assertEq(typedSwitch4(undefined), 4); |
michael@0 | 27 | } |