Skip to content

Commit

Permalink
🔍 test: Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
make-github-pseudonymous-again committed Apr 27, 2020
1 parent b340476 commit 060c808
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 209 deletions.
42 changes: 21 additions & 21 deletions test/src/attr/attr.js
Expand Up @@ -5,11 +5,11 @@ import * as compare from '../../../src';

import util from "util" ;

increasing = compare.attr( compare.increasing , "length" ) ;
decreasing = compare.attr( compare.decreasing , "length" ) ;
const increasing = compare.attr( compare.increasing , "length" ) ;
const decreasing = compare.attr( compare.decreasing , "length" ) ;


function t ( a, b, z ) {
function one( t , a, b, z ) {

t.deepEqual(
compare.sign( increasing( a, b ) ),
Expand All @@ -19,7 +19,7 @@ function t ( a, b, z ) {

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "attr" , t => {

t( [], [], 0 );
t( [], [0], -1 );
t( [0], [], 1 );
t( [0], [0], 0 );
t( [0], [1], 0 );
t( [1], [0], 0 );
one( t , [], [], 0 );
one( t , [], [0], -1 );
one( t , [0], [], 1 );
one( t , [0], [0], 0 );
one( t , [0], [1], 0 );
one( t , [1], [0], 0 );

t( [1, 2], [1, 2, 3], -1 );
t( [1, 3], [1, 2, 3], -1 );
t( [1, 4], [1, 2, 3], -1 );
one( t , [1, 2], [1, 2, 3], -1 );
one( t , [1, 3], [1, 2, 3], -1 );
one( t , [1, 4], [1, 2, 3], -1 );

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

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

t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );

t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );

} ) ;
42 changes: 21 additions & 21 deletions test/src/attr/len.js
Expand Up @@ -5,11 +5,11 @@ import * as compare from '../../../src';

import util from "util" ;

increasing = compare.len( compare.increasing ) ;
decreasing = compare.len( compare.decreasing ) ;
const increasing = compare.len( compare.increasing ) ;
const decreasing = compare.len( compare.decreasing ) ;


function t ( a, b, z ) {
function one( t , a, b, z ) {

t.deepEqual(
compare.sign( increasing( a, b ) ),
Expand All @@ -19,7 +19,7 @@ function t ( a, b, z ) {

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "attr" , t => {

t( [], [], 0 );
t( [], [0], -1 );
t( [0], [], 1 );
t( [0], [0], 0 );
t( [0], [1], 0 );
t( [1], [0], 0 );
one( t , [], [], 0 );
one( t , [], [0], -1 );
one( t , [0], [], 1 );
one( t , [0], [0], 0 );
one( t , [0], [1], 0 );
one( t , [1], [0], 0 );

t( [1, 2], [1, 2, 3], -1 );
t( [1, 3], [1, 2, 3], -1 );
t( [1, 4], [1, 2, 3], -1 );
one( t , [1, 2], [1, 2, 3], -1 );
one( t , [1, 3], [1, 2, 3], -1 );
one( t , [1, 4], [1, 2, 3], -1 );

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

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

t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );

t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );

} ) ;

42 changes: 21 additions & 21 deletions test/src/fn.js
Expand Up @@ -6,11 +6,11 @@ import * as compare from '../../src';
import util from "util" ;
import operator from "@aureooms/js-operator" ;

increasing = compare.fn( compare.increasing , operator.len ) ;
decreasing = compare.fn( compare.decreasing , operator.len ) ;
const increasing = compare.fn( compare.increasing , operator.len ) ;
const decreasing = compare.fn( compare.decreasing , operator.len ) ;


function t ( a, b, z ) {
function one( t , a, b, z ) {

t.deepEqual(
compare.sign( increasing( a, b ) ),
Expand All @@ -20,7 +20,7 @@ function t ( a, b, z ) {

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "attr" , t => {

t( [], [], 0 );
t( [], [0], -1 );
t( [0], [], 1 );
t( [0], [0], 0 );
t( [0], [1], 0 );
t( [1], [0], 0 );
one( t , [], [], 0 );
one( t , [], [0], -1 );
one( t , [0], [], 1 );
one( t , [0], [0], 0 );
one( t , [0], [1], 0 );
one( t , [1], [0], 0 );

t( [1, 2], [1, 2, 3], -1 );
t( [1, 3], [1, 2, 3], -1 );
t( [1, 4], [1, 2, 3], -1 );
one( t , [1, 2], [1, 2, 3], -1 );
one( t , [1, 3], [1, 2, 3], -1 );
one( t , [1, 4], [1, 2, 3], -1 );

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

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

t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], 0 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 0 );

t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], 0 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 0 );

} ) ;

42 changes: 21 additions & 21 deletions test/src/lexicographical/colexicographical.js
Expand Up @@ -5,11 +5,11 @@ import * as compare from '../../../src';

import util from "util" ;

increasing = compare.colexicographical( compare.increasing );
decreasing = compare.reverse( increasing );
const increasing = compare.colexicographical( compare.increasing );
const decreasing = compare.reverse( increasing );


function one ( a, b, z ) {
function one( t , a, b, z ) {

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

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "colexicographical", t => {

one( [], [], 0 );
one( [], [0], -1 );
one( [0], [], 1 );
one( [0], [0], 0 );
one( [0], [1], -1 );
one( [1], [0], 1 );
one( t , [], [], 0 );
one( t , [], [0], -1 );
one( t , [0], [], 1 );
one( t , [0], [0], 0 );
one( t , [0], [1], -1 );
one( t , [1], [0], 1 );

one( [1, 2], [1, 2, 3], -1 );
one( [1, 3], [1, 2, 3], -1 );
one( [1, 4], [1, 2, 3], 1 );
one( t , [1, 2], [1, 2, 3], -1 );
one( t , [1, 3], [1, 2, 3], -1 );
one( t , [1, 4], [1, 2, 3], 1 );

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

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

one( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
one( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );

one( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
one( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );

});
28 changes: 14 additions & 14 deletions test/src/lexicographical/fixedcolexicographical.js
Expand Up @@ -5,11 +5,11 @@ import * as compare from '../../../src';

import util from "util" ;

increasing = compare.fixedcolexicographical( compare.increasing , 5 );
decreasing = compare.fixedcolexicographical( compare.decreasing , 5 );
const increasing = compare.fixedcolexicographical( compare.increasing , 5 );
const decreasing = compare.fixedcolexicographical( compare.decreasing , 5 );


function t ( a, b, z ) {
function one( t , a, b, z ) {

t.deepEqual(
compare.sign( increasing( a, b ) ),
Expand All @@ -19,7 +19,7 @@ function t ( a, b, z ) {

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "fixedcolexicographical", t => {

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

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

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

t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], -1 );

t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], 1 );

});
28 changes: 14 additions & 14 deletions test/src/lexicographical/fixedlexicographical.js
Expand Up @@ -5,11 +5,11 @@ import * as compare from '../../../src';

import util from "util" ;

increasing = compare.fixedlexicographical( compare.increasing , 5 );
decreasing = compare.fixedlexicographical( compare.decreasing , 5 );
const increasing = compare.fixedlexicographical( compare.increasing , 5 );
const decreasing = compare.fixedlexicographical( compare.decreasing , 5 );


function t ( a, b, z ) {
function one( t , a, b, z ) {

t.deepEqual(
compare.sign( increasing( a, b ) ),
Expand All @@ -19,7 +19,7 @@ function t ( a, b, z ) {

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

t.deepEqual(
compare.sign( decreasing( a, b ) ),
-z,
z === 0 ? 0 : -z,
util.format( "d %s %s", JSON.stringify( a ), JSON.stringify( b ) )
);

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

test( "fixedlexicographical", t => {

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

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

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

t( [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
t( [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 1 );
one( t , [0, 6, 6, 6, 6], [1, 7, 7, 7, 7], -1 );
one( t , [1, 6, 6, 6, 6], [0, 7, 7, 7, 7], 1 );

t( [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
t( [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], -1 );
one( t , [6, 6, 6, 6, 0], [7, 7, 7, 7, 1], -1 );
one( t , [6, 6, 6, 6, 1], [7, 7, 7, 7, 0], -1 );

});

0 comments on commit 060c808

Please sign in to comment.