Permalink
Browse files

Simple subtraction of literals

  • Loading branch information...
Josep M. Bach
Josep M. Bach committed May 27, 2011
1 parent 775b85c commit 186891ac6c8726359333499512ef4ec613a8c731
Showing with 7 additions and 3 deletions.
  1. +3 −3 lib/brainscript/ast.rb
  2. +4 −0 test/brainscript/compiler_test.rb
View
@@ -29,14 +29,14 @@ def add(l, r)
out.join("\n")
end
- def add(l, r)
+ def sub(l, r)
out = []
out << "# Assign a"
out << l
out << "# Assign b"
out << ">" + r + "<"
- out << "# Compute sum"
- out << ">[-<+>]<"
+ out << "# Compute subtraction"
+ out << ">[-<->]<"
out.join("\n")
end
end
@@ -6,4 +6,8 @@ def test_simple_addition
assert_evaluates "+>++<>[-<+>]<", '1 + 2'
end
+ def test_simple_subtraction
+ assert_evaluates "+>++<>[-<->]<", '1 - 2'
+ end
+
end

0 comments on commit 186891a

Please sign in to comment.