Skip to content

Commit 060c808

Browse files
🔍 test: Fix tests.
1 parent b340476 commit 060c808

File tree

12 files changed

+209
-209
lines changed

12 files changed

+209
-209
lines changed

test/src/attr/attr.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as compare from '../../../src';
55

66
import util from "util" ;
77

8-
increasing = compare.attr( compare.increasing , "length" ) ;
9-
decreasing = compare.attr( compare.decreasing , "length" ) ;
8+
const increasing = compare.attr( compare.increasing , "length" ) ;
9+
const decreasing = compare.attr( compare.decreasing , "length" ) ;
1010

1111

12-
function t ( a, b, z ) {
12+
function one( t , a, b, z ) {
1313

1414
t.deepEqual(
1515
compare.sign( increasing( a, b ) ),
@@ -19,7 +19,7 @@ function t ( a, b, z ) {
1919

2020
t.deepEqual(
2121
compare.sign( decreasing( a, b ) ),
22-
-z,
22+
z === 0 ? 0 : -z,
2323
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2424
);
2525

@@ -28,27 +28,27 @@ function t ( a, b, z ) {
2828

2929
test( "attr" , t => {
3030

31-
t( [], [], 0 );
32-
t( [], [0], -1 );
33-
t( [0], [], 1 );
34-
t( [0], [0], 0 );
35-
t( [0], [1], 0 );
36-
t( [1], [0], 0 );
31+
one( t , [], [], 0 );
32+
one( t , [], [0], -1 );
33+
one( t , [0], [], 1 );
34+
one( t , [0], [0], 0 );
35+
one( t , [0], [1], 0 );
36+
one( t , [1], [0], 0 );
3737

38-
t( [1, 2], [1, 2, 3], -1 );
39-
t( [1, 3], [1, 2, 3], -1 );
40-
t( [1, 4], [1, 2, 3], -1 );
38+
one( t , [1, 2], [1, 2, 3], -1 );
39+
one( t , [1, 3], [1, 2, 3], -1 );
40+
one( t , [1, 4], [1, 2, 3], -1 );
4141

42-
t( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
43-
t( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
42+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
43+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
4444

45-
t( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
46-
t( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
45+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
46+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
4747

48-
t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
49-
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
48+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
49+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
5050

51-
t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
52-
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
51+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
52+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
5353

5454
} ) ;

test/src/attr/len.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as compare from '../../../src';
55

66
import util from "util" ;
77

8-
increasing = compare.len( compare.increasing ) ;
9-
decreasing = compare.len( compare.decreasing ) ;
8+
const increasing = compare.len( compare.increasing ) ;
9+
const decreasing = compare.len( compare.decreasing ) ;
1010

1111

12-
function t ( a, b, z ) {
12+
function one( t , a, b, z ) {
1313

1414
t.deepEqual(
1515
compare.sign( increasing( a, b ) ),
@@ -19,7 +19,7 @@ function t ( a, b, z ) {
1919

2020
t.deepEqual(
2121
compare.sign( decreasing( a, b ) ),
22-
-z,
22+
z === 0 ? 0 : -z,
2323
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2424
);
2525

@@ -28,28 +28,28 @@ function t ( a, b, z ) {
2828

2929
test( "attr" , t => {
3030

31-
t( [], [], 0 );
32-
t( [], [0], -1 );
33-
t( [0], [], 1 );
34-
t( [0], [0], 0 );
35-
t( [0], [1], 0 );
36-
t( [1], [0], 0 );
31+
one( t , [], [], 0 );
32+
one( t , [], [0], -1 );
33+
one( t , [0], [], 1 );
34+
one( t , [0], [0], 0 );
35+
one( t , [0], [1], 0 );
36+
one( t , [1], [0], 0 );
3737

38-
t( [1, 2], [1, 2, 3], -1 );
39-
t( [1, 3], [1, 2, 3], -1 );
40-
t( [1, 4], [1, 2, 3], -1 );
38+
one( t , [1, 2], [1, 2, 3], -1 );
39+
one( t , [1, 3], [1, 2, 3], -1 );
40+
one( t , [1, 4], [1, 2, 3], -1 );
4141

42-
t( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
43-
t( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
42+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
43+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
4444

45-
t( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
46-
t( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
45+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
46+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
4747

48-
t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
49-
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
48+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
49+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
5050

51-
t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
52-
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
51+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
52+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
5353

5454
} ) ;
5555

test/src/fn.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import * as compare from '../../src';
66
import util from "util" ;
77
import operator from "@aureooms/js-operator" ;
88

9-
increasing = compare.fn( compare.increasing , operator.len ) ;
10-
decreasing = compare.fn( compare.decreasing , operator.len ) ;
9+
const increasing = compare.fn( compare.increasing , operator.len ) ;
10+
const decreasing = compare.fn( compare.decreasing , operator.len ) ;
1111

1212

13-
function t ( a, b, z ) {
13+
function one( t , a, b, z ) {
1414

1515
t.deepEqual(
1616
compare.sign( increasing( a, b ) ),
@@ -20,7 +20,7 @@ function t ( a, b, z ) {
2020

2121
t.deepEqual(
2222
compare.sign( decreasing( a, b ) ),
23-
-z,
23+
z === 0 ? 0 : -z,
2424
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2525
);
2626

@@ -29,28 +29,28 @@ function t ( a, b, z ) {
2929

3030
test( "attr" , t => {
3131

32-
t( [], [], 0 );
33-
t( [], [0], -1 );
34-
t( [0], [], 1 );
35-
t( [0], [0], 0 );
36-
t( [0], [1], 0 );
37-
t( [1], [0], 0 );
32+
one( t , [], [], 0 );
33+
one( t , [], [0], -1 );
34+
one( t , [0], [], 1 );
35+
one( t , [0], [0], 0 );
36+
one( t , [0], [1], 0 );
37+
one( t , [1], [0], 0 );
3838

39-
t( [1, 2], [1, 2, 3], -1 );
40-
t( [1, 3], [1, 2, 3], -1 );
41-
t( [1, 4], [1, 2, 3], -1 );
39+
one( t , [1, 2], [1, 2, 3], -1 );
40+
one( t , [1, 3], [1, 2, 3], -1 );
41+
one( t , [1, 4], [1, 2, 3], -1 );
4242

43-
t( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
44-
t( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
43+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
44+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 0 );
4545

46-
t( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
47-
t( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
46+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], 0 );
47+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 0 );
4848

49-
t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
50-
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
49+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
50+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
5151

52-
t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
53-
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
52+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
53+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
5454

5555
} ) ;
5656

test/src/lexicographical/colexicographical.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as compare from '../../../src';
55

66
import util from "util" ;
77

8-
increasing = compare.colexicographical( compare.increasing );
9-
decreasing = compare.reverse( increasing );
8+
const increasing = compare.colexicographical( compare.increasing );
9+
const decreasing = compare.reverse( increasing );
1010

1111

12-
function one ( a, b, z ) {
12+
function one( t , a, b, z ) {
1313

1414
t.deepEqual(
1515
compare.sign( increasing( a, b ) ),
@@ -19,7 +19,7 @@ function one ( a, b, z ) {
1919

2020
t.deepEqual(
2121
compare.sign( decreasing( a, b ) ),
22-
-z,
22+
z === 0 ? 0 : -z,
2323
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2424
);
2525

@@ -28,27 +28,27 @@ function one ( a, b, z ) {
2828

2929
test( "colexicographical", t => {
3030

31-
one( [], [], 0 );
32-
one( [], [0], -1 );
33-
one( [0], [], 1 );
34-
one( [0], [0], 0 );
35-
one( [0], [1], -1 );
36-
one( [1], [0], 1 );
31+
one( t , [], [], 0 );
32+
one( t , [], [0], -1 );
33+
one( t , [0], [], 1 );
34+
one( t , [0], [0], 0 );
35+
one( t , [0], [1], -1 );
36+
one( t , [1], [0], 1 );
3737

38-
one( [1, 2], [1, 2, 3], -1 );
39-
one( [1, 3], [1, 2, 3], -1 );
40-
one( [1, 4], [1, 2, 3], 1 );
38+
one( t , [1, 2], [1, 2, 3], -1 );
39+
one( t , [1, 3], [1, 2, 3], -1 );
40+
one( t , [1, 4], [1, 2, 3], 1 );
4141

42-
one( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
43-
one( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
42+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
43+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
4444

45-
one( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
46-
one( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
45+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
46+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
4747

48-
one( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
49-
one( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
48+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
49+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
5050

51-
one( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
52-
one( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
51+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
52+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
5353

5454
});

test/src/lexicographical/fixedcolexicographical.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as compare from '../../../src';
55

66
import util from "util" ;
77

8-
increasing = compare.fixedcolexicographical( compare.increasing , 5 );
9-
decreasing = compare.fixedcolexicographical( compare.decreasing , 5 );
8+
const increasing = compare.fixedcolexicographical( compare.increasing , 5 );
9+
const decreasing = compare.fixedcolexicographical( compare.decreasing , 5 );
1010

1111

12-
function t ( a, b, z ) {
12+
function one( t , a, b, z ) {
1313

1414
t.deepEqual(
1515
compare.sign( increasing( a, b ) ),
@@ -19,7 +19,7 @@ function t ( a, b, z ) {
1919

2020
t.deepEqual(
2121
compare.sign( decreasing( a, b ) ),
22-
-z,
22+
z === 0 ? 0 : -z,
2323
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2424
);
2525

@@ -34,7 +34,7 @@ function t ( a, b, z ) {
3434

3535
t.deepEqual(
3636
compare.sign( decreasing( a, b ) ),
37-
-z,
37+
z === 0 ? 0 : -z,
3838
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
3939
);
4040

@@ -43,18 +43,18 @@ function t ( a, b, z ) {
4343

4444
test( "fixedcolexicographical", t => {
4545

46-
t( [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
46+
one( t , [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
4747

48-
t( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
49-
t( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
48+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
49+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
5050

51-
t( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
52-
t( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
51+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
52+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
5353

54-
t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
55-
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
54+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
55+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
5656

57-
t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
58-
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
57+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
58+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
5959

6060
});

test/src/lexicographical/fixedlexicographical.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import * as compare from '../../../src';
55

66
import util from "util" ;
77

8-
increasing = compare.fixedlexicographical( compare.increasing , 5 );
9-
decreasing = compare.fixedlexicographical( compare.decreasing , 5 );
8+
const increasing = compare.fixedlexicographical( compare.increasing , 5 );
9+
const decreasing = compare.fixedlexicographical( compare.decreasing , 5 );
1010

1111

12-
function t ( a, b, z ) {
12+
function one( t , a, b, z ) {
1313

1414
t.deepEqual(
1515
compare.sign( increasing( a, b ) ),
@@ -19,7 +19,7 @@ function t ( a, b, z ) {
1919

2020
t.deepEqual(
2121
compare.sign( decreasing( a, b ) ),
22-
-z,
22+
z === 0 ? 0 : -z,
2323
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
2424
);
2525

@@ -34,7 +34,7 @@ function t ( a, b, z ) {
3434

3535
t.deepEqual(
3636
compare.sign( decreasing( a, b ) ),
37-
-z,
37+
z === 0 ? 0 : -z,
3838
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
3939
);
4040

@@ -43,18 +43,18 @@ function t ( a, b, z ) {
4343

4444
test( "fixedlexicographical", t => {
4545

46-
t( [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
46+
one( t , [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
4747

48-
t( [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
49-
t( [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
48+
one( t , [0, 6, 7, 8, 9], [1, 6, 7, 8, 9], -1 );
49+
one( t , [1, 6, 7, 8, 9], [0, 6, 7, 8, 9], 1 );
5050

51-
t( [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
52-
t( [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
51+
one( t , [9, 8, 7, 6, 0], [9, 8, 7, 6, 1], -1 );
52+
one( t , [9, 8, 7, 6, 1], [9, 8, 7, 6, 0], 1 );
5353

54-
t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
55-
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 1 );
54+
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
55+
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 1 );
5656

57-
t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
58-
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], -1 );
57+
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
58+
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], -1 );
5959

6060
});

0 commit comments

Comments
 (0)