test/unit_tests.rb in gmp-0.1.8 vs test/unit_tests.rb in gmp-0.1.9
- old
+ new
@@ -94,6 +94,30 @@
assert_equal(2, @b.tmod(@a), "GMP::Z.tmod should work.")
assert_equal(2, @a.tmod( 3), "GMP::Z.tmod should work.")
assert_equal(5, @a.tmod(@c), "GMP::Z.tmod should work.")
assert_equal(0, @c.tmod(@a), "GMP::Z.tmod should work.")
end
+
+ def test_z_fmod
+ assert_equal(GMP::Z, @a.fmod(@b).class, "GMP::Z.fmod GMP::Z should be GMP::Z.")
+ assert_equal(GMP::Z, @a.fmod(3).class, "GMP::Z.fmod Fixnum should be GMP::Z.")
+ assert_equal(GMP::Z, @a.fmod(2**32).class, "GMP::Z.fmod Bignum should be GMP::Z.")
+ assert_equal(GMP::Z, @a.fmod(@c).class, "GMP::Z.fmod GMP::Z should be GMP::Z.")
+ assert_equal(5, @a.fmod(@b), "GMP::Z.fmod should work.")
+ assert_equal(2, @b.fmod(@a), "GMP::Z.fmod should work.")
+ assert_equal(2, @a.fmod( 3), "GMP::Z.fmod should work.")
+ assert_equal(5, @a.fmod(@c), "GMP::Z.fmod should work.")
+ assert_equal(0, @c.fmod(@a), "GMP::Z.fmod should work.")
+ end
+
+ def test_z_cmod
+ assert_equal(GMP::Z, @a.cmod(@b).class, "GMP::Z.cmod GMP::Z should be GMP::Z.")
+ assert_equal(GMP::Z, @a.cmod(3).class, "GMP::Z.cmod Fixnum should be GMP::Z.")
+ assert_equal(GMP::Z, @a.cmod(2**32).class, "GMP::Z.cmod Bignum should be GMP::Z.")
+ assert_equal(GMP::Z, @a.cmod(@c).class, "GMP::Z.cmod GMP::Z should be GMP::Z.")
+ assert_equal( -2, @a.cmod(@b), "GMP::Z.cmod should work.")
+ assert_equal( -3, @b.cmod(@a), "GMP::Z.cmod should work.")
+ assert_equal( -1, @a.cmod( 3), "GMP::Z.cmod should work.")
+ assert_equal(-20, @a.cmod(@c), "GMP::Z.cmod should work.")
+ assert_equal( 0, @c.cmod(@a), "GMP::Z.cmod should work.")
+ end
end
\ No newline at end of file