test/model/spec_variable.rb in pione-0.1.3 vs test/model/spec_variable.rb in pione-0.1.4

- old
+ new

@@ -14,70 +14,68 @@ @a.should.not == @b end describe 'pione method ==' do it 'should true' do - @a.call_pione_method("==", @a).should.true vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneInteger.new(1)) - BinaryOperator.new("==", @a, @b).eval(vtable).should.true + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneInteger.new(1).to_seq) + BinaryOperator.new("==", @a, @b).eval(vtable).should == PioneBoolean.new(true).to_seq end it 'should false' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneInteger.new(2)) - BinaryOperator.new("==", @a, @b).eval(vtable).should.false + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneInteger.new(2).to_seq) + BinaryOperator.new("==", @a, @b).eval(vtable).should == PioneBoolean.new(false).to_seq end it 'should raise unbound variable error' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) + vtable.set(@a, PioneInteger.new(1).to_seq) should.raise(UnboundVariableError) do BinaryOperator.new("==", @a, @b).eval(vtable) end end it 'should raise type error' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneFloat.new(1.0)) - should.raise(PioneModelTypeError) do + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneFloat.new(1.0).to_seq) + should.raise(MethodNotFound) do BinaryOperator.new("==", @a, @b).eval(vtable) end end end describe 'pione method !=' do it 'should true' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneInteger.new(2)) - BinaryOperator.new("!=", @a, @b).eval(vtable).should.true + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneInteger.new(2).to_seq) + BinaryOperator.new("!=", @a, @b).eval(vtable).should == PioneBoolean.new(true).to_seq end it 'should false' do - @a.call_pione_method("!=", @a).should.false vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneInteger.new(1)) - BinaryOperator.new("!=", @a, @b).eval(vtable).should.false + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneInteger.new(1).to_seq) + BinaryOperator.new("!=", @a, @b).eval(vtable).should == PioneBoolean.new(false).to_seq end it 'should raise unbound variable error' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) + vtable.set(@a, PioneInteger.new(1).to_seq) should.raise(UnboundVariableError) do BinaryOperator.new("!=", @a, @b).eval(vtable) end end it 'should raise type error' do vtable = VariableTable.new - vtable.set(@a, PioneInteger.new(1)) - vtable.set(@b, PioneFloat.new(1.0)) - should.raise(PioneModelTypeError) do + vtable.set(@a, PioneInteger.new(1).to_seq) + vtable.set(@b, PioneFloat.new(1.0).to_seq) + should.raise(MethodNotFound) do BinaryOperator.new("!=", @a, @b).eval(vtable) end end end end