Sha256: b5802eb9799faab346a00b73c21cce404ad5f8768c89b4f2c253aa9611539b8f

Contents?: true

Size: 1.06 KB

Versions: 52

Compression:

Stored size: 1.06 KB

Contents

require File.expand_path('../../../spec_helper', __FILE__)

describe :complex_rect, :shared => true do
  before(:each) do
    @numbers = [
      Complex(1),
      Complex(0, 20),
      Complex(0, 0),
      Complex(0.0),
      Complex(9999999**99),
      Complex(-20),
      Complex.polar(76, 10)
    ]
  end

  it "returns an Array" do
    @numbers.each do |number|
      number.send(@method).should be_an_instance_of(Array)
    end
  end

  it "returns a two-element Array" do
    @numbers.each do |number|
      number.send(@method).size.should == 2
    end
  end

  it "returns the real part of self as the first element" do
   @numbers.each do |number|
     number.send(@method).first.should == number.real
   end
  end

  it "returns the imaginary part of self as the last element" do
     @numbers.each do |number|
       number.send(@method).last.should == number.imaginary
     end
  end

  it "raises an ArgumentError if given any arguments" do
    @numbers.each do |number|
      lambda { number.send(@method, number) }.should raise_error(ArgumentError)
    end
  end
end

Version data entries

52 entries across 52 versions & 2 rubygems

Version Path
rhodes-7.6.0 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-7.5.1 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-7.4.1 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-7.1.17 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-6.2.0 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-6.0.11 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.18 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.17 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.15 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.0.22 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.2 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.0.7 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.0.3 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-5.5.0 spec/framework_spec/app/spec/shared/complex/rect.rb
tauplatform-1.0.3 spec/framework_spec/app/spec/shared/complex/rect.rb
tauplatform-1.0.2 spec/framework_spec/app/spec/shared/complex/rect.rb
tauplatform-1.0.1 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-3.5.1.12 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-3.3.5 spec/framework_spec/app/spec/shared/complex/rect.rb
rhodes-3.4.2 spec/framework_spec/app/spec/shared/complex/rect.rb