2026-07-10 08:52:52 +03:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from src.snanosm.mealy import Machine
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestMachine(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
def test_init(self):
|
|
|
|
|
m = Machine()
|
2026-07-15 14:20:27 +03:00
|
|
|
self.assertIsNotNone(m)
|
|
|
|
|
|
|
|
|
|
def test_add_state_two_start_states(self):
|
|
|
|
|
m = Machine()
|
|
|
|
|
m.add_state("A", {}, True, False)
|
|
|
|
|
self.assertRaises(ValueError, m.add_state, "B", {}, True, False)
|
|
|
|
|
|
|
|
|
|
def test_add_two_end_states(self):
|
|
|
|
|
m = Machine()
|
|
|
|
|
m.add_state("A", {}, True, False)
|
|
|
|
|
m.add_state("B", {}, False, True)
|
|
|
|
|
m.add_state("C", {}, False, True)
|