rlsm 0.2.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,25 +0,0 @@
1
- require File.join(File.dirname(__FILE__), '..', 'lib', 'rlsm', 'regexp')
2
-
3
- describe RLSM::RegExp do
4
- ['(ab', '(|ab)', '(ab|)', 'ab(*)', '(*a|b)', 'ab()cd'].each do |str|
5
- it "should raise error for input #{str}" do
6
- lambda { RLSM::RegExp.new str }.should raise_error(Exception)
7
- end
8
- end
9
-
10
- ['', '&', 'a', 'a|b', 'ab', '(a|b)c', '(a*|bc&&&d)|abc|(a|b|c)*'].each do |s|
11
- it "should accept the input #{s}" do
12
- lambda { RLSM::RegExp.new s }.should_not raise_error(Exception)
13
- end
14
- end
15
-
16
- it "should simplify a input" do
17
- RLSM::RegExp.new('a&&**&&c***(bbbcccaa)**').to_s.should == 'ac*(bbbcccaa)*'
18
- end
19
-
20
- it "should convert a regexp to an dfa" do
21
- dfa1 = RLSM::RegExp.new('(a|b)aa*(&|b)a*').to_dfa
22
- dfa1.states.size.should == 4
23
- dfa1.final_states.map {|f| f.label}.sort.should == ['1', '2'].sort
24
- end
25
- end