diff options
Diffstat (limited to 'spec/ruby/library/cmath/math/shared/log10.rb')
-rw-r--r-- | spec/ruby/library/cmath/math/shared/log10.rb | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/spec/ruby/library/cmath/math/shared/log10.rb b/spec/ruby/library/cmath/math/shared/log10.rb deleted file mode 100644 index f49934d958..0000000000 --- a/spec/ruby/library/cmath/math/shared/log10.rb +++ /dev/null @@ -1,41 +0,0 @@ -require_relative '../fixtures/classes' - -describe :complex_math_log10, shared: true do - it "returns the base-10 logarithm of the passed argument" do - @object.send(:log10, 0.0001).should be_close(-4.0, TOLERANCE) - @object.send(:log10, 0.000000000001e-15).should be_close(-27.0, TOLERANCE) - @object.send(:log10, 1).should be_close(0.0, TOLERANCE) - @object.send(:log10, 10).should be_close(1.0, TOLERANCE) - @object.send(:log10, 10e15).should be_close(16.0, TOLERANCE) - end - - it "returns the base-10 logarithm for Complex numbers" do - @object.send(:log10, Complex(3, 4)).should be_close(Complex(0.698970004336019, 0.402719196273373), TOLERANCE) - @object.send(:log10, Complex(-3, 4)).should be_close(Complex(0.698970004336019, 0.961657157568468), TOLERANCE) - end - - # BUG: does not work correctly, because Math#log10 - # does not check for negative values - #it "returns the base-10 logarithm for negative numbers as a Complex number" do - # @object.send(:log10, -10).should be_close(Complex(2.30258509299405, 3.14159265358979), TOLERANCE) - # @object.send(:log10, -20).should be_close(Complex(2.99573227355399, 3.14159265358979), TOLERANCE) - #end -end - -describe :complex_math_log10_bang, shared: true do - it "returns the base-10 logarithm of the argument" do - @object.send(:log10!, 0.0001).should be_close(-4.0, TOLERANCE) - @object.send(:log10!, 0.000000000001e-15).should be_close(-27.0, TOLERANCE) - @object.send(:log10!, 1).should be_close(0.0, TOLERANCE) - @object.send(:log10!, 10).should be_close(1.0, TOLERANCE) - @object.send(:log10!, 10e15).should be_close(16.0, TOLERANCE) - end - - it "raises an Errno::EDOM when the passed argument is negative" do - -> { @object.send(:log10!, -10) }.should raise_error(Errno::EDOM) - end - - it "raises a TypeError when passed a Complex number" do - -> { @object.send(:log10!, Complex(4, 5)) }.should raise_error(TypeError) - end -end |