Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: test/mjsunit/compare-table-sne.js

Issue 1069673002: Add more systematic tests for comparisons. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/compare-table-seq.js ('k') | tools/compare-table-gen.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,214 7483648,Infinity,-Infinity,NaN];
6 var expected = [
7 [false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
8 [true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
9 [true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
10 [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
11 [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
12 [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
13 [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
14 [true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
15 [true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ],
16 [true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ],
17 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ],
18 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ],
19 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false ,true ,true ,true ,true ],
20 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ],
21 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ],
22 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ],
23 [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ]
24 ];
25 var func = (function sne(a,b) { return a !== b; });
26 var left_funcs = [
27 (function sne_L0(b) { return true !== b; }),
28 (function sne_L1(b) { return false !== b; }),
29 (function sne_L2(b) { return null !== b; }),
30 (function sne_L3(b) { return void 0 !== b; }),
31 (function sne_L4(b) { return 0 !== b; }),
32 (function sne_L5(b) { return 0.0 !== b; }),
33 (function sne_L6(b) { return -0 !== b; }),
34 (function sne_L7(b) { return "" !== b; }),
35 (function sne_L8(b) { return -1 !== b; }),
36 (function sne_L9(b) { return -1.25 !== b; }),
37 (function sne_L10(b) { return 1 !== b; }),
38 (function sne_L11(b) { return 1.25 !== b; }),
39 (function sne_L12(b) { return -2147483648 !== b; }),
40 (function sne_L13(b) { return 2147483648 !== b; }),
41 (function sne_L14(b) { return Infinity !== b; }),
42 (function sne_L15(b) { return -Infinity !== b; }),
43 (function sne_L16(b) { return NaN !== b; })
44 ];
45 var right_funcs = [
46 (function sne_R0(a) { return a !== true; }),
47 (function sne_R1(a) { return a !== false; }),
48 (function sne_R2(a) { return a !== null; }),
49 (function sne_R3(a) { return a !== void 0; }),
50 (function sne_R4(a) { return a !== 0; }),
51 (function sne_R5(a) { return a !== 0.0; }),
52 (function sne_R6(a) { return a !== -0; }),
53 (function sne_R7(a) { return a !== ""; }),
54 (function sne_R8(a) { return a !== -1; }),
55 (function sne_R9(a) { return a !== -1.25; }),
56 (function sne_R10(a) { return a !== 1; }),
57 (function sne_R11(a) { return a !== 1.25; }),
58 (function sne_R12(a) { return a !== -2147483648; }),
59 (function sne_R13(a) { return a !== 2147483648; }),
60 (function sne_R14(a) { return a !== Infinity; }),
61 (function sne_R15(a) { return a !== -Infinity; }),
62 (function sne_R16(a) { return a !== NaN; })
63 ];
64 function matrix() {
65 return [
66 [true !== true,true !== false,true !== null,true !== void 0,true !== 0,true !== 0.0,true !== -0,true !== "",true !== -1,true !== -1.25,true !== 1,true !== 1 .25,true !== -2147483648,true !== 2147483648,true !== Infinity,true !== -Infinit y,true !== NaN],
67 [false !== true,false !== false,false !== null,false !== void 0,false !== 0, false !== 0.0,false !== -0,false !== "",false !== -1,false !== -1.25,false !== 1 ,false !== 1.25,false !== -2147483648,false !== 2147483648,false !== Infinity,fa lse !== -Infinity,false !== NaN],
68 [null !== true,null !== false,null !== null,null !== void 0,null !== 0,null !== 0.0,null !== -0,null !== "",null !== -1,null !== -1.25,null !== 1,null !== 1 .25,null !== -2147483648,null !== 2147483648,null !== Infinity,null !== -Infinit y,null !== NaN],
69 [void 0 !== true,void 0 !== false,void 0 !== null,void 0 !== void 0,void 0 ! == 0,void 0 !== 0.0,void 0 !== -0,void 0 !== "",void 0 !== -1,void 0 !== -1.25,v oid 0 !== 1,void 0 !== 1.25,void 0 !== -2147483648,void 0 !== 2147483648,void 0 !== Infinity,void 0 !== -Infinity,void 0 !== NaN],
70 [0 !== true,0 !== false,0 !== null,0 !== void 0,0 !== 0,0 !== 0.0,0 !== -0,0 !== "",0 !== -1,0 !== -1.25,0 !== 1,0 !== 1.25,0 !== -2147483648,0 !== 21474836 48,0 !== Infinity,0 !== -Infinity,0 !== NaN],
71 [0.0 !== true,0.0 !== false,0.0 !== null,0.0 !== void 0,0.0 !== 0,0.0 !== 0. 0,0.0 !== -0,0.0 !== "",0.0 !== -1,0.0 !== -1.25,0.0 !== 1,0.0 !== 1.25,0.0 !== -2147483648,0.0 !== 2147483648,0.0 !== Infinity,0.0 !== -Infinity,0.0 !== NaN],
72 [-0 !== true,-0 !== false,-0 !== null,-0 !== void 0,-0 !== 0,-0 !== 0.0,-0 ! == -0,-0 !== "",-0 !== -1,-0 !== -1.25,-0 !== 1,-0 !== 1.25,-0 !== -2147483648,- 0 !== 2147483648,-0 !== Infinity,-0 !== -Infinity,-0 !== NaN],
73 ["" !== true,"" !== false,"" !== null,"" !== void 0,"" !== 0,"" !== 0.0,"" ! == -0,"" !== "","" !== -1,"" !== -1.25,"" !== 1,"" !== 1.25,"" !== -2147483648," " !== 2147483648,"" !== Infinity,"" !== -Infinity,"" !== NaN],
74 [-1 !== true,-1 !== false,-1 !== null,-1 !== void 0,-1 !== 0,-1 !== 0.0,-1 ! == -0,-1 !== "",-1 !== -1,-1 !== -1.25,-1 !== 1,-1 !== 1.25,-1 !== -2147483648,- 1 !== 2147483648,-1 !== Infinity,-1 !== -Infinity,-1 !== NaN],
75 [-1.25 !== true,-1.25 !== false,-1.25 !== null,-1.25 !== void 0,-1.25 !== 0, -1.25 !== 0.0,-1.25 !== -0,-1.25 !== "",-1.25 !== -1,-1.25 !== -1.25,-1.25 !== 1 ,-1.25 !== 1.25,-1.25 !== -2147483648,-1.25 !== 2147483648,-1.25 !== Infinity,-1 .25 !== -Infinity,-1.25 !== NaN],
76 [1 !== true,1 !== false,1 !== null,1 !== void 0,1 !== 0,1 !== 0.0,1 !== -0,1 !== "",1 !== -1,1 !== -1.25,1 !== 1,1 !== 1.25,1 !== -2147483648,1 !== 21474836 48,1 !== Infinity,1 !== -Infinity,1 !== NaN],
77 [1.25 !== true,1.25 !== false,1.25 !== null,1.25 !== void 0,1.25 !== 0,1.25 !== 0.0,1.25 !== -0,1.25 !== "",1.25 !== -1,1.25 !== -1.25,1.25 !== 1,1.25 !== 1 .25,1.25 !== -2147483648,1.25 !== 2147483648,1.25 !== Infinity,1.25 !== -Infinit y,1.25 !== NaN],
78 [-2147483648 !== true,-2147483648 !== false,-2147483648 !== null,-2147483648 !== void 0,-2147483648 !== 0,-2147483648 !== 0.0,-2147483648 !== -0,-2147483648 !== "",-2147483648 !== -1,-2147483648 !== -1.25,-2147483648 !== 1,-2147483648 ! == 1.25,-2147483648 !== -2147483648,-2147483648 !== 2147483648,-2147483648 !== I nfinity,-2147483648 !== -Infinity,-2147483648 !== NaN],
79 [2147483648 !== true,2147483648 !== false,2147483648 !== null,2147483648 !== void 0,2147483648 !== 0,2147483648 !== 0.0,2147483648 !== -0,2147483648 !== "", 2147483648 !== -1,2147483648 !== -1.25,2147483648 !== 1,2147483648 !== 1.25,2147 483648 !== -2147483648,2147483648 !== 2147483648,2147483648 !== Infinity,2147483 648 !== -Infinity,2147483648 !== NaN],
80 [Infinity !== true,Infinity !== false,Infinity !== null,Infinity !== void 0, Infinity !== 0,Infinity !== 0.0,Infinity !== -0,Infinity !== "",Infinity !== -1, Infinity !== -1.25,Infinity !== 1,Infinity !== 1.25,Infinity !== -2147483648,Inf inity !== 2147483648,Infinity !== Infinity,Infinity !== -Infinity,Infinity !== N aN],
81 [-Infinity !== true,-Infinity !== false,-Infinity !== null,-Infinity !== voi d 0,-Infinity !== 0,-Infinity !== 0.0,-Infinity !== -0,-Infinity !== "",-Infinit y !== -1,-Infinity !== -1.25,-Infinity !== 1,-Infinity !== 1.25,-Infinity !== -2 147483648,-Infinity !== 2147483648,-Infinity !== Infinity,-Infinity !== -Infinit y,-Infinity !== NaN],
82 [NaN !== true,NaN !== false,NaN !== null,NaN !== void 0,NaN !== 0,NaN !== 0. 0,NaN !== -0,NaN !== "",NaN !== -1,NaN !== -1.25,NaN !== 1,NaN !== 1.25,NaN !== -2147483648,NaN !== 2147483648,NaN !== Infinity,NaN !== -Infinity,NaN !== NaN]
83 ];
84 }
85 function test() {
86 for (var i = 0; i < values.length; i++) {
87 for (var j = 0; j < values.length; j++) {
88 var a = values[i];
89 var b = values[j];
90 var x = expected[i][j];
91 assertEquals(x, func(a,b));
92 assertEquals(x, left_funcs[i](b));
93 assertEquals(x, right_funcs[j](a));
94 }
95 }
96
97 var result = matrix();
98 for (var i = 0; i < values.length; i++) {
99 for (var j = 0; j < values.length; j++) {
100 assertEquals(expected[i][j], result[i][j]);
101 }
102 }
103 }
104 test();
105 test();
OLDNEW
« no previous file with comments | « test/mjsunit/compare-table-seq.js ('k') | tools/compare-table-gen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698