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