2018-09-25 06:41:16 -04:00
|
|
|
require_relative '../../spec_helper'
|
2017-05-07 08:04:49 -04:00
|
|
|
|
|
|
|
describe "Complex#inspect" do
|
2018-09-25 06:41:16 -04:00
|
|
|
it "returns (${real}+${image}i) for positive imaginary parts" do
|
|
|
|
Complex(1).inspect.should == "(1+0i)"
|
|
|
|
Complex(7).inspect.should == "(7+0i)"
|
|
|
|
Complex(-1, 4).inspect.should == "(-1+4i)"
|
|
|
|
Complex(-7, 6.7).inspect.should == "(-7+6.7i)"
|
|
|
|
end
|
|
|
|
|
|
|
|
it "returns (${real}-${image}i) for negative imaginary parts" do
|
|
|
|
Complex(0, -1).inspect.should == "(0-1i)"
|
|
|
|
Complex(-1, -4).inspect.should == "(-1-4i)"
|
|
|
|
Complex(-7, -6.7).inspect.should == "(-7-6.7i)"
|
|
|
|
end
|
2017-05-07 08:04:49 -04:00
|
|
|
end
|