Пример #1
0
 def test_odd_zeroes(self):
     with open('./test_cases/OddZeroes.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', '0']
         result = NFAInterface.main()
         self.assertTrue(result)
Пример #2
0
 def no_accept_state(self):
     with open('./test_cases/NoAccept.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', 'aaaaa']
         result = NFAInterface.main()
         self.assertFalse(result)
Пример #3
0
 def test_lambda(self):
     with open('./test_cases/NFAExample.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', 'a']
         result = NFAInterface.main()
         self.assertTrue(result)
Пример #4
0
 def test_b_not_accepted(self):
     with open('./test_cases/NFAExample.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', 'b']
         result = NFAInterface.main()
         self.assertFalse(result)
Пример #5
0
 def test_empty_string_accepted(self):
     with open('./test_cases/NFAExample.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', '']
         result = NFAInterface.main()
         self.assertTrue(result)
Пример #6
0
 def test_empty_string_not_accepted(self):
     with open('./test_cases/OddZeroes.txt', 'r') as f:
         sys.stdin = f
         sys.argv = ['', '']
         result = NFAInterface.main()
         self.assertFalse(result)