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 | if (typeof ParallelArray === "undefined") |
michael@0 | 2 | quit(); |
michael@0 | 3 | |
michael@0 | 4 | x = ParallelArray() |
michael@0 | 5 | y = x.shape |
michael@0 | 6 | Object.defineProperty(this, "z", { |
michael@0 | 7 | get: function() { |
michael@0 | 8 | return x.flatten() |
michael@0 | 9 | } |
michael@0 | 10 | }) |
michael@0 | 11 | Object.defineProperty(y, 5, { |
michael@0 | 12 | value: this |
michael@0 | 13 | }); |
michael@0 | 14 | y[8] = z |
michael@0 | 15 | valueOf = (function() { |
michael@0 | 16 | function f() { |
michael@0 | 17 | (.9 % 1) > f |
michael@0 | 18 | } |
michael@0 | 19 | return f |
michael@0 | 20 | })(this, {}) |
michael@0 | 21 | x.shape.join() |
michael@0 | 22 | |
michael@0 | 23 | |
michael@0 | 24 | assertArraySeqParResultsEq(range(0, 1024), "filter", function(e, i) { return (i % (1.1)) != 0; }); |
michael@0 | 25 | function range(n, m) { |
michael@0 | 26 | var result = []; |
michael@0 | 27 | for (var i = n; i < m; i++) |
michael@0 | 28 | result.push(i); |
michael@0 | 29 | return result; |
michael@0 | 30 | } |
michael@0 | 31 | function assertArraySeqParResultsEq(arr, op, func) { |
michael@0 | 32 | arr[op].apply(arr, [func]); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | |
michael@0 | 36 | function foo(v) { |
michael@0 | 37 | if (v < -200) return 0; |
michael@0 | 38 | if (v > 200) return 0; |
michael@0 | 39 | return v % 1; |
michael@0 | 40 | } |
michael@0 | 41 | assertEq(foo(0.9), 0.9); |
michael@0 | 42 | assertEq(foo(0.9), 0.9); |