Skip to content

Commit 66a8afe

Browse files
🔍 test: Test absolute value methods.
1 parent d148271 commit 66a8afe

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/src/Integer/abs.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import test from 'ava' ;
2+
import { ZZ } from '../../../src' ;
3+
4+
function macro ( t , x ) {
5+
t.is(x.toString().replace(/-/,''), ZZ.from(x).iabs().toString());
6+
}
7+
8+
macro.title = ( providedTitle , x ) => `${x}^2 = ${x*x}` ;
9+
10+
test( macro , -1 ) ;
11+
test( macro , 0 ) ;
12+
test( macro , 1 ) ;
13+
test( macro , 2 ) ;
14+
test( macro , 777 ) ;
15+
test( macro , -17321983 ) ;
16+
17+
test( macro , '-729482732476982648726149821745982176489127458124719264742194') ;
18+
test( macro , '62393657923765943267853265893279658365') ;

0 commit comments

Comments
 (0)