Skip to content

Commit 1144799

Browse files
test subtraction with 0's
1 parent a99a028 commit 1144799

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/src/Integer/arithmetic.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,15 @@ test( 'multiply two large numbers in-place' , t => {
200200
t.is( b.toString( ) , B ) ;
201201

202202
}) ;
203+
204+
test( 'add and subtract with 0' , t => {
205+
206+
const a = ZZ.from('9999999999999999', 10);
207+
const b = ZZ.$0();
208+
209+
t.is( a.sub(b).toString(10) , '9999999999999999' ) ;
210+
t.is( a.sub(a).toString(10) , '0' ) ;
211+
t.is( b.sub(a).toString(10) , '-9999999999999999' ) ;
212+
t.is( b.sub(b).toString(10) , '0' ) ;
213+
214+
}) ;

0 commit comments

Comments
 (0)