@@ -13,6 +13,12 @@ for (const file of files) {
13
13
}
14
14
}
15
15
16
+ function correction ( x ) {
17
+ // eslint-disable-next-line no-compare-neg-zero
18
+ if ( x === - 0 ) return 0
19
+ return x
20
+ }
21
+
16
22
// eslint-disable-next-line no-labels
17
23
inline: {
18
24
const logic = new LogicEngine ( undefined , { compatible : true } )
@@ -25,13 +31,13 @@ inline: {
25
31
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
26
32
testCase [ 1 ]
27
33
) } `, ( ) => {
28
- expect ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
34
+ expect ( correction ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
29
35
} )
30
36
31
37
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
32
38
testCase [ 1 ]
33
39
) } (async)`, async ( ) => {
34
- expect ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
40
+ expect ( correction ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
35
41
testCase [ 2 ]
36
42
)
37
43
} )
@@ -40,26 +46,26 @@ inline: {
40
46
testCase [ 1 ]
41
47
) } (built)`, ( ) => {
42
48
const f = logic . build ( testCase [ 0 ] )
43
- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
49
+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
44
50
} )
45
51
46
52
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
47
53
testCase [ 1 ]
48
54
) } (asyncBuilt)`, async ( ) => {
49
55
const f = await asyncLogic . build ( testCase [ 0 ] )
50
- expect ( await f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
56
+ expect ( correction ( await f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
51
57
} )
52
58
53
59
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
54
60
testCase [ 1 ]
55
61
) } (noOptimization)`, ( ) => {
56
- expect ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
62
+ expect ( correction ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
57
63
} )
58
64
59
65
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
60
66
testCase [ 1 ]
61
67
) } (asyncNoOptimization)`, async ( ) => {
62
- expect ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
68
+ expect ( correction ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
63
69
testCase [ 2 ]
64
70
)
65
71
} )
@@ -68,14 +74,14 @@ inline: {
68
74
testCase [ 1 ]
69
75
) } (builtNoOptimization)`, ( ) => {
70
76
const f = logicWithoutOptimization . build ( testCase [ 0 ] )
71
- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
77
+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
72
78
} )
73
79
74
80
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
75
81
testCase [ 1 ]
76
82
) } (asyncBuiltNoOptimization)`, async ( ) => {
77
83
const f = await asyncLogicWithoutOptimization . build ( testCase [ 0 ] )
78
- expect ( await f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
84
+ expect ( correction ( await f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
79
85
} )
80
86
} )
81
87
} )
@@ -97,13 +103,13 @@ notInline: {
97
103
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
98
104
testCase [ 1 ]
99
105
) } `, ( ) => {
100
- expect ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
106
+ expect ( correction ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
101
107
} )
102
108
103
109
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
104
110
testCase [ 1 ]
105
111
) } (async)`, async ( ) => {
106
- expect ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
112
+ expect ( correction ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
107
113
testCase [ 2 ]
108
114
)
109
115
} )
@@ -112,26 +118,26 @@ notInline: {
112
118
testCase [ 1 ]
113
119
) } (built)`, ( ) => {
114
120
const f = logic . build ( testCase [ 0 ] )
115
- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
121
+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
116
122
} )
117
123
118
124
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
119
125
testCase [ 1 ]
120
126
) } (asyncBuilt)`, async ( ) => {
121
127
const f = await asyncLogic . build ( testCase [ 0 ] )
122
- expect ( await f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
128
+ expect ( correction ( await f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
123
129
} )
124
130
125
131
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
126
132
testCase [ 1 ]
127
133
) } (noOptimization)`, ( ) => {
128
- expect ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
134
+ expect ( correction ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
129
135
} )
130
136
131
137
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
132
138
testCase [ 1 ]
133
139
) } (asyncNoOptimization)`, async ( ) => {
134
- expect ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
140
+ expect ( correction ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
135
141
testCase [ 2 ]
136
142
)
137
143
} )
@@ -140,14 +146,14 @@ notInline: {
140
146
testCase [ 1 ]
141
147
) } (builtNoOptimization)`, ( ) => {
142
148
const f = logicWithoutOptimization . build ( testCase [ 0 ] )
143
- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
149
+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
144
150
} )
145
151
146
152
test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
147
153
testCase [ 1 ]
148
154
) } (asyncBuiltNoOptimization)`, async ( ) => {
149
155
const f = await asyncLogicWithoutOptimization . build ( testCase [ 0 ] )
150
- expect ( await f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
156
+ expect ( correction ( await f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
151
157
} )
152
158
} )
153
159
}
0 commit comments