@@ -365,25 +365,25 @@ mod test_biguint {
365
365
#[ test]
366
366
fn test_from_primitive ( ) {
367
367
let two: BigUint = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
368
- assert_eq ! ( two. to_str( ) , ~ "2 ");
368
+ assert_eq ! ( two. to_str( ) . as_slice ( ) , "2" ) ;
369
369
}
370
370
371
371
#[ test]
372
372
fn test_from_str ( ) {
373
373
let two: BigUint = FromStr :: from_str ( "2" ) . unwrap ( ) ;
374
- assert_eq!(two.to_str(), ~ " 2 ");
374
+ assert_eq ! ( two. to_str( ) . as_slice ( ) , "2" ) ;
375
375
}
376
376
377
377
#[ test]
378
378
fn test_from_str_radix ( ) {
379
379
let two = BigUint :: from_str_radix ( "1a" , 16 ) . unwrap ( ) ;
380
- assert_eq!(two.to_str(), ~ " 26 ");
380
+ assert_eq ! ( two. to_str( ) . as_slice ( ) , "26" ) ;
381
381
}
382
382
383
383
#[ test]
384
384
fn test_to_biguint ( ) {
385
385
let three = 3 u. to_biguint ( ) . unwrap ( ) ;
386
- assert_eq!(three.to_str(), ~ " 3 ");
386
+ assert_eq ! ( three. to_str( ) . as_slice ( ) , "3" ) ;
387
387
}
388
388
389
389
#[ test]
@@ -411,8 +411,8 @@ mod test_biguint {
411
411
fn test_zero_and_one ( ) {
412
412
let zero: BigUint = Zero :: zero ( ) ;
413
413
let one: BigUint = One :: one ( ) ;
414
- assert_eq!(zero.to_str(), ~ " 0 ");
415
- assert_eq!(one.to_str(), ~ " 1 ");
414
+ assert_eq ! ( zero. to_str( ) . as_slice ( ) , "0" ) ;
415
+ assert_eq ! ( one. to_str( ) . as_slice ( ) , "1" ) ;
416
416
}
417
417
418
418
#[ test]
@@ -436,26 +436,26 @@ mod test_biguint {
436
436
let two: BigUint = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
437
437
let three: BigUint = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
438
438
439
- assert_eq!(two.add(&three).to_str(), ~ " 5 ");
440
- assert_eq!((two + three).to_str(), ~ " 5 ");
439
+ assert_eq ! ( two. add( & three) . to_str( ) . as_slice ( ) , "5" ) ;
440
+ assert_eq ! ( ( two + three) . to_str( ) . as_slice ( ) , "5" ) ;
441
441
}
442
442
443
443
#[ test]
444
444
fn test_simple_sub ( ) {
445
445
let two: BigUint = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
446
446
let three: BigUint = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
447
447
448
- assert_eq!(three.sub(&two).to_str(), ~ " 1 ");
449
- assert_eq!((three - two).to_str(), ~ " 1 ");
448
+ assert_eq ! ( three. sub( & two) . to_str( ) . as_slice ( ) , "1" ) ;
449
+ assert_eq ! ( ( three - two) . to_str( ) . as_slice ( ) , "1" ) ;
450
450
}
451
451
452
452
#[ test]
453
453
fn test_mul ( ) {
454
454
let two: BigUint = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
455
455
let three: BigUint = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
456
456
457
- assert_eq!(two.mul(&three).to_str(), ~ " 6 ");
458
- assert_eq!((two * three).to_str(), ~ " 6 ");
457
+ assert_eq ! ( two. mul( & three) . to_str( ) . as_slice ( ) , "6" ) ;
458
+ assert_eq ! ( ( two * three) . to_str( ) . as_slice ( ) , "6" ) ;
459
459
}
460
460
461
461
#[ test]
@@ -569,15 +569,15 @@ mod test_bigint {
569
569
fn test_zero_and_one ( ) {
570
570
let zero: BigInt = Zero :: zero ( ) ;
571
571
let one: BigInt = One :: one ( ) ;
572
- assert_eq!(zero.to_str(), ~ " 0 ");
573
- assert_eq!(one.to_str(), ~ " 1 ");
572
+ assert_eq ! ( zero. to_str( ) . as_slice ( ) , "0" ) ;
573
+ assert_eq ! ( one. to_str( ) . as_slice ( ) , "1" ) ;
574
574
}
575
575
576
576
#[ test]
577
577
fn test_to_biguint ( ) {
578
578
let three: BigInt = FromPrimitive :: from_int ( 3 ) . unwrap ( ) ;
579
579
let minusthree: BigInt = FromPrimitive :: from_int ( -3 ) . unwrap ( ) ;
580
- assert_eq!(three.to_biguint().unwrap().to_str(), ~ " 3 ");
580
+ assert_eq ! ( three. to_biguint( ) . unwrap( ) . to_str( ) . as_slice ( ) , "3" ) ;
581
581
assert_eq ! ( minusthree. to_biguint( ) , None ) ;
582
582
}
583
583
@@ -586,26 +586,26 @@ mod test_bigint {
586
586
let two: BigInt = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
587
587
let three: BigInt = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
588
588
589
- assert_eq!(two.add(&three).to_str(), ~ " 5 ");
590
- assert_eq!((two + three).to_str(), ~ " 5 ");
589
+ assert_eq ! ( two. add( & three) . to_str( ) . as_slice ( ) , "5" ) ;
590
+ assert_eq ! ( ( two + three) . to_str( ) . as_slice ( ) , "5" ) ;
591
591
}
592
592
593
593
#[ test]
594
594
fn test_simple_sub ( ) {
595
595
let two: BigInt = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
596
596
let three: BigInt = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
597
597
598
- assert_eq!(three.sub(&two).to_str(), ~ " 1 ");
599
- assert_eq!((three - two).to_str(), ~ " 1 ");
598
+ assert_eq ! ( three. sub( & two) . to_str( ) . as_slice ( ) , "1" ) ;
599
+ assert_eq ! ( ( three - two) . to_str( ) . as_slice ( ) , "1" ) ;
600
600
}
601
601
602
602
#[ test]
603
603
fn test_mul ( ) {
604
604
let two: BigInt = FromPrimitive :: from_uint ( 2 ) . unwrap ( ) ;
605
605
let three: BigInt = FromPrimitive :: from_uint ( 3 ) . unwrap ( ) ;
606
606
607
- assert_eq!(two.mul(&three).to_str(), ~ " 6 ");
608
- assert_eq!((two * three).to_str(), ~ " 6 " ) ;
607
+ assert_eq ! ( two. mul( & three) . to_str( ) . as_slice ( ) , "6" ) ;
608
+ assert_eq ! ( ( two * three) . to_str( ) . as_slice ( ) , "6" ) ;
609
609
}
610
610
611
611
#[ test]
0 commit comments