Skip to content

Commit f25d49b

Browse files
😒 chore: Patch tests.
1 parent 368a88a commit f25d49b

14 files changed

+116
-100
lines changed

test/src/attr/attr.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, t;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.attr( compare.increasing , "length" ) ;
89
decreasing = compare.attr( compare.decreasing , "length" ) ;
910

1011

11-
t = function ( a, b, z ) {
12+
function t ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,7 +26,7 @@ t = function ( a, b, z ) {
2526
};
2627

2728

28-
test( "attr" , function ( ) {
29+
test( "attr" , t => {
2930

3031
t( [], [], 0 );
3132
t( [], [0], -1 );

test/src/attr/len.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, t;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.len( compare.increasing ) ;
89
decreasing = compare.len( compare.decreasing ) ;
910

1011

11-
t = function ( a, b, z ) {
12+
function t ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,7 +26,7 @@ t = function ( a, b, z ) {
2526
};
2627

2728

28-
test( "attr" , function ( ) {
29+
test( "attr" , t => {
2930

3031
t( [], [], 0 );
3132
t( [], [0], -1 );

test/src/decreasing.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
import test from 'ava';
2+
import * as compare from '../../src';
13

24

3-
test( "decreasing", function () {
5+
test( "decreasing", t => {
46

57

6-
ok( compare.decreasing( Infinity, 0 ) < 0, "double <" );
7-
ok( compare.decreasing( Infinity, Infinity ) === 0, "double =" );
8-
ok( compare.decreasing( 0, Infinity ) > 0, "double >" );
8+
t.truthy( compare.decreasing( Infinity, 0 ) < 0, "double <" );
9+
t.truthy( compare.decreasing( Infinity, Infinity ) === 0, "double =" );
10+
t.truthy( compare.decreasing( 0, Infinity ) > 0, "double >" );
911

10-
ok( compare.decreasing( "abc", "ab" ) < 0, "string <" );
11-
ok( compare.decreasing( "abc", "abc" ) === 0, "string =" );
12-
ok( compare.decreasing( "ab", "abc" ) > 0, "string >" );
12+
t.truthy( compare.decreasing( "abc", "ab" ) < 0, "string <" );
13+
t.truthy( compare.decreasing( "abc", "abc" ) === 0, "string =" );
14+
t.truthy( compare.decreasing( "ab", "abc" ) > 0, "string >" );
1315

1416

1517
});

test/src/fn.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1+
import test from 'ava';
2+
import * as compare from '../../src';
13

24

3-
var util, increasing, decreasing, operator, t;
45

5-
util = require( "util" );
6-
operator = require( "@aureooms/js-operator" ) ;
6+
import util from "util" ;
7+
import operator from "@aureooms/js-operator" ;
78

89
increasing = compare.fn( compare.increasing , operator.len ) ;
910
decreasing = compare.fn( compare.decreasing , operator.len ) ;
1011

1112

12-
t = function ( a, b, z ) {
13+
function t ( a, b, z ) {
1314

14-
deepEqual(
15+
t.deepEqual(
1516
compare.sign( increasing( a, b ) ),
1617
z,
1718
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1819
);
1920

20-
deepEqual(
21+
t.deepEqual(
2122
compare.sign( decreasing( a, b ) ),
2223
-z,
2324
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -26,7 +27,7 @@ t = function ( a, b, z ) {
2627
};
2728

2829

29-
test( "attr" , function ( ) {
30+
test( "attr" , t => {
3031

3132
t( [], [], 0 );
3233
t( [], [0], -1 );

test/src/increasing.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
import test from 'ava';
2+
import * as compare from '../../src';
13

24

3-
test( "increasing", function () {
5+
test( "increasing", t => {
46

57

6-
ok( compare.increasing( 0, Infinity ) < 0, "double <" );
7-
ok( compare.increasing( Infinity, Infinity ) === 0, "double =" );
8-
ok( compare.increasing( Infinity, 0 ) > 0, "double >" );
8+
t.truthy( compare.increasing( 0, Infinity ) < 0, "double <" );
9+
t.truthy( compare.increasing( Infinity, Infinity ) === 0, "double =" );
10+
t.truthy( compare.increasing( Infinity, 0 ) > 0, "double >" );
911

10-
ok( compare.increasing( "ab", "abc" ) < 0, "string <" );
11-
ok( compare.increasing( "abc", "abc" ) === 0, "string =" );
12-
ok( compare.increasing( "abc", "ab" ) > 0, "string >" );
12+
t.truthy( compare.increasing( "ab", "abc" ) < 0, "string <" );
13+
t.truthy( compare.increasing( "abc", "abc" ) === 0, "string =" );
14+
t.truthy( compare.increasing( "abc", "ab" ) > 0, "string >" );
1315

1416

1517
});

test/src/lexicographical/colexicographical.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, one;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.colexicographical( compare.increasing );
89
decreasing = compare.reverse( increasing );
910

1011

11-
one = function ( a, b, z ) {
12+
function one ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,7 +26,7 @@ one = function ( a, b, z ) {
2526
};
2627

2728

28-
test( "colexicographical", function () {
29+
test( "colexicographical", t => {
2930

3031
one( [], [], 0 );
3132
one( [], [0], -1 );

test/src/lexicographical/fixedcolexicographical.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, t;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.fixedcolexicographical( compare.increasing , 5 );
89
decreasing = compare.fixedcolexicographical( compare.decreasing , 5 );
910

1011

11-
t = function ( a, b, z ) {
12+
function t ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,13 +26,13 @@ t = function ( a, b, z ) {
2526
a = a.concat( Math.random( ) ) ;
2627
b = b.concat( Math.random( ) ) ;
2728

28-
deepEqual(
29+
t.deepEqual(
2930
compare.sign( increasing( a, b ) ),
3031
z,
3132
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
3233
);
3334

34-
deepEqual(
35+
t.deepEqual(
3536
compare.sign( decreasing( a, b ) ),
3637
-z,
3738
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -40,7 +41,7 @@ t = function ( a, b, z ) {
4041
};
4142

4243

43-
test( "fixedcolexicographical", function () {
44+
test( "fixedcolexicographical", t => {
4445

4546
t( [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
4647

test/src/lexicographical/fixedlexicographical.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, t;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.fixedlexicographical( compare.increasing , 5 );
89
decreasing = compare.fixedlexicographical( compare.decreasing , 5 );
910

1011

11-
t = function ( a, b, z ) {
12+
function t ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,13 +26,13 @@ t = function ( a, b, z ) {
2526
a = a.concat( Math.random( ) ) ;
2627
b = b.concat( Math.random( ) ) ;
2728

28-
deepEqual(
29+
t.deepEqual(
2930
compare.sign( increasing( a, b ) ),
3031
z,
3132
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
3233
);
3334

34-
deepEqual(
35+
t.deepEqual(
3536
compare.sign( decreasing( a, b ) ),
3637
-z,
3738
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -40,7 +41,7 @@ t = function ( a, b, z ) {
4041
};
4142

4243

43-
test( "fixedlexicographical", function () {
44+
test( "fixedlexicographical", t => {
4445

4546
t( [1, 6, 7, 8, 9], [1, 6, 7, 8, 9], 0 );
4647

test/src/lexicographical/lexicographical.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, one;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.lexicographical( compare.increasing );
89
decreasing = compare.reverse( increasing );
910

1011

11-
one = function ( a, b, z ) {
12+
function one ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,7 +26,7 @@ one = function ( a, b, z ) {
2526
};
2627

2728

28-
test( "lexicographical", function () {
29+
test( "lexicographical", t => {
2930

3031
one( [], [], 0 );
3132
one( [], [0], -1 );

test/src/lexicographical/quasicolexicographical.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
1+
import test from 'ava';
2+
import * as compare from '../../../src';
13

24

3-
var util, increasing, decreasing, one;
45

5-
util = require( "util" );
6+
import util from "util" ;
67

78
increasing = compare.quasicolexicographical( compare.increasing );
89
decreasing = compare.reverse( increasing );
910

1011

11-
one = function ( a, b, z ) {
12+
function one ( a, b, z ) {
1213

13-
deepEqual(
14+
t.deepEqual(
1415
compare.sign( increasing( a, b ) ),
1516
z,
1617
util.format( "i %s %s", JSON.stringify( a ), JSON.stringify( b ) )
1718
);
1819

19-
deepEqual(
20+
t.deepEqual(
2021
compare.sign( decreasing( a, b ) ),
2122
-z,
2223
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
@@ -25,7 +26,7 @@ one = function ( a, b, z ) {
2526
};
2627

2728

28-
test( "quasicolexicographical", function () {
29+
test( "quasicolexicographical", t => {
2930

3031
one( [], [], 0 );
3132
one( [], [0], -1 );

0 commit comments

Comments
 (0)