Skip to content

Commit 1049a18

Browse files
🔍 test: Cover divide_knowing_divisible_by.
1 parent 327572d commit 1049a18

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import test from 'ava' ;
2+
3+
import { ZZ , ZeroDivisionError } from '../../../src' ;
4+
5+
function macro ( t , a , b , q ) {
6+
const A = ZZ.from(a) ;
7+
const B = ZZ.from(b) ;
8+
const Q = A.divide_knowing_divisible_by(B) ;
9+
10+
t.is(q.toString(), Q.toString()) ;
11+
t.is(a.toString(), A.toString()) ;
12+
t.is(b.toString(), B.toString()) ;
13+
}
14+
15+
macro.title = ( providedTitle , a , b , q , r ) => `${a} divide_knowing_divisible_by ${b} = ${q}` ;
16+
17+
test(macro, 3, 1, 3) ;
18+
test(macro, '123', 3, 41) ;
19+
test(macro, 15, 5, 3) ;
20+
test(macro, 17, 17, 1) ;
21+
test(macro, 18, 6, 3) ;
22+
23+
test(macro,
24+
'-7244741064308655582166346607524458070674504593046523339005489416933659838435253944103203222937740081100645849',
25+
'10633823966279326983230456482242756607',
26+
'-681292175541205709486531011694243236571309860372760091522256581907552807',
27+
)
28+
29+
test(macro,
30+
'-7244741064308655582166346607524458070674504593046523339005489416933659838435253944103203222937740081100645849',
31+
'-681292175541205709486531011694243236571309860372760091522256581907552807',
32+
'10633823966279326983230456482242756607',
33+
)
34+
35+
test(macro,
36+
'7244741064308655582166346607524458070674504593046523339005489416933659838435253944103203222937740081100645849',
37+
'-10633823966279326983230456482242756607',
38+
'-681292175541205709486531011694243236571309860372760091522256581907552807',
39+
)
40+
41+
test(macro,
42+
'7244741064308655582166346607524458070674504593046523339005489416933659838435253944103203222937740081100645849',
43+
'-681292175541205709486531011694243236571309860372760091522256581907552807',
44+
'-10633823966279326983230456482242756607',
45+
)

0 commit comments

Comments
 (0)