spec/symbol_spec.rb in nydp-0.1.8 vs spec/symbol_spec.rb in nydp-0.1.9
- old
+ new
@@ -1,8 +1,12 @@
require 'spec_helper'
describe Nydp::Symbol do
+ let(:bar) { Nydp::Symbol.mk :BAR, ns }
+ let(:foo) { Nydp::Symbol.mk :FOO, ns }
+ let(:vm) { Nydp::VM.new }
+
it "returns a ruby symbol in #to_ruby" do
sym = Nydp::Symbol.mk :foo, ns
expect(sym.to_ruby).to eq :foo
end
@@ -35,6 +39,39 @@
expect(sym1 == sym2).to eq true
expect(sym1.eql? sym2).to eq true
expect(sym1.equal? sym2).to eq false
end
+
+ it "works with builtin greater-than when true" do
+ f = Nydp::Builtin::GreaterThan.new
+
+ f.invoke vm, pair_list([foo, bar])
+
+ expect(vm.pop_arg).to eq Nydp.T
+ end
+
+ it "works with builtin greater-than when false" do
+ f = Nydp::Builtin::GreaterThan.new
+
+ f.invoke vm, pair_list([bar, foo])
+
+ expect(vm.pop_arg).to eq Nydp.NIL
+ end
+
+ it "works with builtin less-than when true" do
+ f = Nydp::Builtin::LessThan.new
+
+ f.invoke vm, pair_list([bar, foo])
+
+ expect(vm.pop_arg).to eq Nydp.T
+ end
+
+ it "works with builtin less-than when false" do
+ f = Nydp::Builtin::LessThan.new
+
+ f.invoke vm, pair_list([foo, bar])
+
+ expect(vm.pop_arg).to eq Nydp.NIL
+ end
+
end