test/import/test_shake_lexer.rb in tracksperanto-1.6.5 vs test/import/test_shake_lexer.rb in tracksperanto-1.6.6
- old
+ new
@@ -1,9 +1,9 @@
require File.dirname(__FILE__) + '/../helper'
class ShakeLexerTest < Test::Unit::TestCase
- P = File.dirname(__FILE__) + "/samples/shake_tracker_nodes.shk"
+ P = File.dirname(__FILE__) + "/samples/shake_script/shake_tracker_nodes.shk"
L = Tracksperanto::ShakeGrammar::Lexer
def test_parse_single_cmt
cmt = " // Mary had a little lamb"
s = parse(cmt)
@@ -13,10 +13,21 @@
def test_parse_two_line_cmt
cmt = [" // Mary had a little lamb", " // Old McDonald had a farm"].join("\n\n\n\n\n\n")
s = parse(cmt)
assert_equal [[:comment, " Mary had a little lamb"], [:comment, " Old McDonald had a farm"]], s
end
-
+
+ def test_parse_hermite_curve
+ curve = 'Hermite(0,[1379.04,-0.02,-0.02]@1,[1379.04,-0.03,-0.03]@2)'
+ s = parse(curve)
+ assert_equal [
+ [:funcall, "Hermite", [:atom_i, 0],
+ [:arr, [:atom_f, 1379.04], [:atom_f, -0.02], [:atom_f, -0.02]], [:atom_at_i, 1],
+ [:arr, [:atom_f, 1379.04], [:atom_f, -0.03], [:atom_f, -0.03]], [:atom_at_i, 2]
+ ]
+ ], s
+ end
+
def test_parse_cmt_and_unknown
cmt = " // Mary had a little lamb\nFooBar"
s = parse(cmt)
assert_equal [[:comment, " Mary had a little lamb"], [:atom, "FooBar"]], s
end
\ No newline at end of file