1
1
import test from 'ava' ;
2
- import { _add , _sub , _mul , _div , _cmp } from '../../src' ;
2
+ import { _add , _sub , _mul , _div , _cmp , _cmp_no_bounds } from '../../src' ;
3
3
4
4
import int from 'int' ;
5
5
import { ZZ } from '@aureooms/js-integer' ;
6
6
7
7
const GOOGOL = '10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000' ;
8
8
9
- function macro ( t , alu , [ [ _x , _y , _z , factory ] , a , b , c , d , e ] ) {
9
+ function macro ( t , alu , [ [ _x , _y , factory ] , a , b , c , d , e ] ) {
10
10
11
11
const apply = factory ( alu ) ;
12
12
@@ -26,7 +26,7 @@ function macro ( t , alu , [ [ _x , _y , _z , factory ] , a , b , c , d , e ] )
26
26
}
27
27
28
28
macro . title = ( _ , alu , [ [ name , op , impl ] , a , b , c , d , e ] ) => {
29
- return `${ name } <${ impl } , ${ alu . name } > ${ a } /${ b } ${ op } ${ c } /${ d } = ${ e } ` ;
29
+ return `${ name } <${ impl . name } , ${ alu . name } > ${ a } /${ b } ${ op } ${ c } /${ d } = ${ e } ` ;
30
30
} ;
31
31
32
32
const ALU = [
@@ -60,11 +60,11 @@ const ALU = [
60
60
}
61
61
] ;
62
62
63
- const add = [ 'add' , '+' , '_add' , alu => _add ( alu ) ] ;
64
- const sub = [ 'sub' , '-' , '_sub' , alu => _sub ( alu ) ] ;
65
- const mul = [ 'mul' , '*' , '_mul' , alu => _mul ( alu ) ] ;
66
- const div = [ 'div' , '/' , '_div' , alu => _div ( alu ) ] ;
67
- const cmp = [ 'cmp' , '~' , ' _cmp' , alu => _cmp ( alu ) ] ;
63
+ const add = [ 'add' , '+' , [ _add ] ] ;
64
+ const sub = [ 'sub' , '-' , [ _sub ] ] ;
65
+ const mul = [ 'mul' , '*' , [ _mul ] ] ;
66
+ const div = [ 'div' , '/' , [ _div ] ] ;
67
+ const cmp = [ 'cmp' , '~' , [ _cmp , _cmp_no_bounds ] ] ;
68
68
69
69
const PARAMS = [
70
70
@@ -134,5 +134,6 @@ const PARAMS = [
134
134
] ;
135
135
136
136
for ( const alu of ALU )
137
- for ( const params of PARAMS )
138
- test ( macro , alu , params ) ;
137
+ for ( const [ [ name , symbol , implementations ] , ...params ] of PARAMS )
138
+ for ( const factory of implementations )
139
+ test ( macro , alu , [ [ name , symbol , factory ] , ...params ] ) ;
0 commit comments