@@ -7,21 +7,19 @@ my $knowhow := pir::get_knowhow__P();
7
7
my $ bi_type := $ knowhow . HOW . new_type(: name(' TestBigInt' ), : repr(' P6bigint' ));
8
8
$ bi_type . HOW . compose($ bi_type );
9
9
sub s ($ x ) { pir::nqp_bigint_to_str__SP($ x ) };
10
+ sub iseq ($ x , $ y ) { nqp ::iseq_I($ x , nqp ::box_i($ y , $ bi_type )) }
10
11
11
12
my $ one := nqp ::box_i(1 , $ bi_type );
12
13
13
14
my $ b := pir::nqp_bigint_from_str__PPS($ one , ' -123' );
14
15
my $ c := nqp ::box_i(-123 , $ bi_type );
15
- say (s($ c ));
16
- say (s(nqp ::box_i(2 , $ bi_type )));
17
- say (nqp ::unbox_i($ c ));
18
16
19
17
ok (s($ b ) eq ' -123' , ' can round-trip negative number (string)' );
20
18
ok (s($ c ) eq ' -123' , ' can round-trip negative number (string) by boxing' );
21
19
ok (nqp ::unbox_i($ b ) == -123 , ' can round-trip negative number by unboxing' );
22
20
ok (! nqp ::iseq_I($ one , $ b ), ' nqp::iseq_I can return false' );
23
21
ok (nqp ::iseq_I($ one , $ one ), ' nqp::iseq_I can return true' );
24
- ok (nqp ::iseq_I (nqp ::mul_I($ b , $ b ), 15129 ,), ' multiplication' );
25
- ok (nqp ::iseq_I (nqp ::add_I($ b , $ b ), -246 ,), ' addition' );
22
+ ok (iseq (nqp ::mul_I($ b , $ b ), 15129 ,), ' multiplication' );
23
+ ok (iseq (nqp ::add_I($ b , $ b ), -246 ,), ' addition' );
26
24
ok (nqp ::iseq_I(nqp ::sub_I($ b , $ b ), nqp ::box_i(0 , $ bi_type )), ' subtraction' );
27
25
ok (nqp ::iseq_I(nqp ::div_I($ b , $ b ), $ one ), ' division' );
0 commit comments