@@ -13,6 +13,12 @@ for (const file of files) {
1313 }
1414}
1515
16+ function correction ( x ) {
17+ // eslint-disable-next-line no-compare-neg-zero
18+ if ( x === - 0 ) return 0
19+ return x
20+ }
21+
1622// eslint-disable-next-line no-labels
1723inline: {
1824 const logic = new LogicEngine ( undefined , { compatible : true } )
@@ -25,13 +31,13 @@ inline: {
2531 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
2632 testCase [ 1 ]
2733 ) } `, ( ) => {
28- expect ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
34+ expect ( correction ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
2935 } )
3036
3137 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
3238 testCase [ 1 ]
3339 ) } (async)`, async ( ) => {
34- expect ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
40+ expect ( correction ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
3541 testCase [ 2 ]
3642 )
3743 } )
@@ -40,26 +46,26 @@ inline: {
4046 testCase [ 1 ]
4147 ) } (built)`, ( ) => {
4248 const f = logic . build ( testCase [ 0 ] )
43- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
49+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
4450 } )
4551
4652 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
4753 testCase [ 1 ]
4854 ) } (asyncBuilt)`, async ( ) => {
4955 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 ] )
5157 } )
5258
5359 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
5460 testCase [ 1 ]
5561 ) } (noOptimization)`, ( ) => {
56- expect ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
62+ expect ( correction ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
5763 } )
5864
5965 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
6066 testCase [ 1 ]
6167 ) } (asyncNoOptimization)`, async ( ) => {
62- expect ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
68+ expect ( correction ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
6369 testCase [ 2 ]
6470 )
6571 } )
@@ -68,14 +74,14 @@ inline: {
6874 testCase [ 1 ]
6975 ) } (builtNoOptimization)`, ( ) => {
7076 const f = logicWithoutOptimization . build ( testCase [ 0 ] )
71- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
77+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
7278 } )
7379
7480 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
7581 testCase [ 1 ]
7682 ) } (asyncBuiltNoOptimization)`, async ( ) => {
7783 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 ] )
7985 } )
8086 } )
8187 } )
@@ -97,13 +103,13 @@ notInline: {
97103 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
98104 testCase [ 1 ]
99105 ) } `, ( ) => {
100- expect ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
106+ expect ( correction ( logic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
101107 } )
102108
103109 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
104110 testCase [ 1 ]
105111 ) } (async)`, async ( ) => {
106- expect ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
112+ expect ( correction ( await asyncLogic . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
107113 testCase [ 2 ]
108114 )
109115 } )
@@ -112,26 +118,26 @@ notInline: {
112118 testCase [ 1 ]
113119 ) } (built)`, ( ) => {
114120 const f = logic . build ( testCase [ 0 ] )
115- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
121+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
116122 } )
117123
118124 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
119125 testCase [ 1 ]
120126 ) } (asyncBuilt)`, async ( ) => {
121127 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 ] )
123129 } )
124130
125131 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
126132 testCase [ 1 ]
127133 ) } (noOptimization)`, ( ) => {
128- expect ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
134+ expect ( correction ( logicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
129135 } )
130136
131137 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
132138 testCase [ 1 ]
133139 ) } (asyncNoOptimization)`, async ( ) => {
134- expect ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) . toStrictEqual (
140+ expect ( correction ( await asyncLogicWithoutOptimization . run ( testCase [ 0 ] , testCase [ 1 ] ) ) ) . toStrictEqual (
135141 testCase [ 2 ]
136142 )
137143 } )
@@ -140,14 +146,14 @@ notInline: {
140146 testCase [ 1 ]
141147 ) } (builtNoOptimization)`, ( ) => {
142148 const f = logicWithoutOptimization . build ( testCase [ 0 ] )
143- expect ( f ( testCase [ 1 ] ) ) . toStrictEqual ( testCase [ 2 ] )
149+ expect ( correction ( f ( testCase [ 1 ] ) ) ) . toStrictEqual ( testCase [ 2 ] )
144150 } )
145151
146152 test ( `${ JSON . stringify ( testCase [ 0 ] ) } ${ JSON . stringify (
147153 testCase [ 1 ]
148154 ) } (asyncBuiltNoOptimization)`, async ( ) => {
149155 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 ] )
151157 } )
152158 } )
153159}
0 commit comments