Sha256: 16aa510e1520d6494b8224cf8ec81685f07ef29f15272f583161a56cf2a6d9e3
Contents?: true
Size: 698 Bytes
Versions: 2
Compression:
Stored size: 698 Bytes
Contents
require 'minitest_helper' class TestTokens < MiniTest::Unit::TestCase include Qlang::Lexer::Tokens def setup end def full_match(rgx, str) assert_equal(0, rgx =~ str) assert_equal(str, $&) end def not_match(rgx, str) assert_equal(nil, rgx =~ str) end def test_nums full_match(NUM, '1') full_match(NUM, '234987423') full_match(NUM, '23423948.298743') full_match(NUM, 'e') full_match(NUM, 'pi') not_match(NUM, 'a') end def test_function full_match(/[fgh]\(\w( ?, ?\w)*\) ?= ?[^\r\n]+/, 'f(x) = xy') end def test_differentiate rgx = /d\/d[a-zA-Z] .*/ full_match(rgx, 'd/dx sin(x)') full_match(rgx, 'd/dz z^2') end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
hilbert-0.0.2700000 | test/internal/test_tokens.rb |
qlang-0.0.27182124 | test/internal/test_tokens.rb |