Skip to content
This repository has been archived by the owner on Jun 6, 2018. It is now read-only.

Commit

Permalink
add failing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Feb 4, 2008
1 parent a8213d9 commit 58a4410
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
5 changes: 2 additions & 3 deletions CHANGES
@@ -1,5 +1,4 @@
* Version 1.0.1
* 1.0.1

New features:
- Port to Python 2.0+ (Wojciech Wieczorek)

- Port to Python 2.0+ (Wojciech Wieczorek, Giovanni Visciano, Alejandro Acosta)
3 changes: 3 additions & 0 deletions CREDITS
@@ -1,5 +1,8 @@
Bug fixes:
* Alejandro Acosta araleius@gmail.com
* Wojciech Wieczorek wieczor@ultra.cto.us.edu.pl
* Giovanni Visciano giovanni_visciano@yahoo.it

Bug reports:
* Giovanni Visciano giovanni_visciano@yahoo.it
* Wojciech Wieczorek wieczor@ultra.cto.us.edu.pl
29 changes: 26 additions & 3 deletions tests/tests.py
Expand Up @@ -7,9 +7,32 @@ class TestFSA(unittest.TestCase):
def setUp(self):
pass

def testshuffle(self):
fsa = compileRE('a*')
#self.assertEqual(self.seq, range(10))
def testsRejects(self):
fsa = compileRE('a(b|c*)')
self.assertFalse(fsa.accepts("abbb"))

def testDeterminization(self):
states = [0, 1, 2, 3]
alphabet = ['a']
transitions = [(0, 1, 'a'),
(0, 2, 'a'),
(1, 0, 'b'),
(1, 3, 'a'),
(2, 0, 'a'),
(2, 2, 'b'),
(2, 3, 'a')]
initialState = 0
finalStates = [3]
fsa = FSA(states, alphabet, transitions, initialState, finalStates)
self.assertTrue(fsa.accepts('aba'))
dfa = fsa.determinized()
self.assertTrue(dfa.accepts('aba'))

def testMinimization(self):
fsa = concatenation(singleton("a"),minimize(closure(singleton("b"))))
self.assertFalse(fsa.accepts("b"))
fsa = concatenation(singleton("a"),closure(singleton("b")))
self.assertFalse(fsa.accepts("b"))

if __name__ == '__main__':
unittest.main()

0 comments on commit 58a4410

Please sign in to comment.