From 1276bc8e1c8df34476a809e980c7fae3de0816d4 Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Sun, 20 Apr 2014 16:32:40 +0200 Subject: [PATCH] add core/fixnum/{<, <=, >, >=} specs --- test/test-android/app/core/fixnum/gt_spec.rb | 17 +++++++++++++++++ test/test-android/app/core/fixnum/gte_spec.rb | 18 ++++++++++++++++++ test/test-android/app/core/fixnum/lt_spec.rb | 17 +++++++++++++++++ test/test-android/app/core/fixnum/lte_spec.rb | 18 ++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 test/test-android/app/core/fixnum/gt_spec.rb create mode 100644 test/test-android/app/core/fixnum/gte_spec.rb create mode 100644 test/test-android/app/core/fixnum/lt_spec.rb create mode 100644 test/test-android/app/core/fixnum/lte_spec.rb diff --git a/test/test-android/app/core/fixnum/gt_spec.rb b/test/test-android/app/core/fixnum/gt_spec.rb new file mode 100644 index 00000000..6f6e516c --- /dev/null +++ b/test/test-android/app/core/fixnum/gt_spec.rb @@ -0,0 +1,17 @@ +describe "Fixnum#>" do + it "returns true if self is greater than the given argument" do + (13 > 2).should == true + (-500 > -600).should == true + + (1 > 5).should == false + (5 > 5).should == false + + (900 > bignum_value).should == false + (5 > 4.999).should == true + end + + it "raises an ArgumentError when given a non-Integer" do + lambda { 5 > "4" }.should raise_error(ArgumentError) + lambda { 5 > mock('x') }.should raise_error(ArgumentError) + end +end diff --git a/test/test-android/app/core/fixnum/gte_spec.rb b/test/test-android/app/core/fixnum/gte_spec.rb new file mode 100644 index 00000000..f94ecfc4 --- /dev/null +++ b/test/test-android/app/core/fixnum/gte_spec.rb @@ -0,0 +1,18 @@ +describe "Fixnum#>=" do + it "returns true if self is greater than or equal to the given argument" do + (13 >= 2).should == true + (-500 >= -600).should == true + + (1 >= 5).should == false + (2 >= 2).should == true + (5 >= 5).should == true + + (900 >= bignum_value).should == false + (5 >= 4.999).should == true + end + + it "raises an ArgumentError when given a non-Integer" do + lambda { 5 >= "4" }.should raise_error(ArgumentError) + lambda { 5 >= mock('x') }.should raise_error(ArgumentError) + end +end diff --git a/test/test-android/app/core/fixnum/lt_spec.rb b/test/test-android/app/core/fixnum/lt_spec.rb new file mode 100644 index 00000000..6364acc8 --- /dev/null +++ b/test/test-android/app/core/fixnum/lt_spec.rb @@ -0,0 +1,17 @@ +describe "Fixnum#<" do + it "returns true if self is less than the given argument" do + (2 < 13).should == true + (-600 < -500).should == true + + (5 < 1).should == false + (5 < 5).should == false + + (900 < bignum_value).should == true + (5 < 4.999).should == false + end + + it "raises an ArgumentError when given a non-Integer" do + lambda { 5 < "4" }.should raise_error(ArgumentError) + lambda { 5 < mock('x') }.should raise_error(ArgumentError) + end +end diff --git a/test/test-android/app/core/fixnum/lte_spec.rb b/test/test-android/app/core/fixnum/lte_spec.rb new file mode 100644 index 00000000..37c7df86 --- /dev/null +++ b/test/test-android/app/core/fixnum/lte_spec.rb @@ -0,0 +1,18 @@ +describe "Fixnum#<=" do + it "returns true if self is less than or equal to other" do + (2 <= 13).should == true + (-600 <= -500).should == true + + (5 <= 1).should == false + (5 <= 5).should == true + (-2 <= -2).should == true + + (900 <= bignum_value).should == true + (5 <= 4.999).should == false + end + + it "raises an ArgumentError when given a non-Integer" do + lambda { 5 <= "4" }.should raise_error(ArgumentError) + lambda { 5 <= mock('x') }.should raise_error(ArgumentError) + end +end