def test_reverse_brzozowski():
    brzozowski = fsm(alphabet={'a', 'b'}, states={'A', 'B', 'C', 'D', 'E'}, initial='A', finals={'C', 'E'}, map={'A': {'a': 'B', 'b': 'D'}, 'B': {'a': 'C', 'b': 'E'}, 'C': {'a': 'C', 'b': 'E'}, 'D': {'a': 'B', 'b': 'D'}, 'E': {'a': 'B', 'b': 'D'}})
    assert brzozowski.accepts('aa')
    assert brzozowski.accepts('ab')
    assert brzozowski.accepts('aab')
    assert brzozowski.accepts('bab')
    assert brzozowski.accepts('abbbbbbbab')
    assert (not brzozowski.accepts(''))
    assert (not brzozowski.accepts('a'))
    assert (not brzozowski.accepts('b'))
    assert (not brzozowski.accepts('ba'))
    assert (not brzozowski.accepts('bb'))
    assert (not brzozowski.accepts('bbbbbbbbbbbb'))
    b2 = reversed(brzozowski)
    assert b2.accepts('aa')
    assert b2.accepts('ba')
    assert b2.accepts('baa')
    assert b2.accepts('bab')
    assert b2.accepts('babbbbbbba')
    assert (not b2.accepts(''))
    assert (not b2.accepts('a'))
    assert (not b2.accepts('b'))
    assert (not b2.accepts('ab'))
    assert (not b2.accepts('bb'))
    assert (not b2.accepts('bbbbbbbbbbbb'))
    gen = b2.strings()
    assert (next(gen) == ['a', 'a'])
    assert (next(gen) == ['b', 'a'])
    assert (next(gen) == ['a', 'a', 'a'])
    assert (next(gen) == ['a', 'a', 'b'])
    assert (next(gen) == ['b', 'a', 'a'])
    assert (next(gen) == ['b', 'a', 'b'])
    assert (next(gen) == ['a', 'a', 'a', 'a'])
def test_reverse_brzozowski():
    brzozowski = fsm(alphabet={'a', 'b'}, states={'A', 'B', 'C', 'D', 'E'}, initial='A', finals={'C', 'E'}, map={'A': {'a': 'B', 'b': 'D'}, 'B': {'a': 'C', 'b': 'E'}, 'C': {'a': 'C', 'b': 'E'}, 'D': {'a': 'B', 'b': 'D'}, 'E': {'a': 'B', 'b': 'D'}})
    assert brzozowski.accepts('aa')
    assert brzozowski.accepts('ab')
    assert brzozowski.accepts('aab')
    assert brzozowski.accepts('bab')
    assert brzozowski.accepts('abbbbbbbab')
    assert (not brzozowski.accepts())
    assert (not brzozowski.accepts('a'))
    assert (not brzozowski.accepts('b'))
    assert (not brzozowski.accepts('ba'))
    assert (not brzozowski.accepts('bb'))
    assert (not brzozowski.accepts('bbbbbbbbbbbb'))
    b2 = reversed(brzozowski)
    assert b2.accepts('aa')
    assert b2.accepts('ba')
    assert b2.accepts('baa')
    assert b2.accepts('bab')
    assert b2.accepts('babbbbbbba')
    assert (not b2.accepts())
    assert (not b2.accepts('a'))
    assert (not b2.accepts('b'))
    assert (not b2.accepts('ab'))
    assert (not b2.accepts('bb'))
    assert (not b2.accepts('bbbbbbbbbbbb'))
    gen = b2.strings()
    assert (next(gen) == ['a', 'a'])
    assert (next(gen) == ['b', 'a'])
    assert (next(gen) == ['a', 'a', 'a'])
    assert (next(gen) == ['a', 'a', 'b'])
    assert (next(gen) == ['b', 'a', 'a'])
    assert (next(gen) == ['b', 'a', 'b'])
    assert (next(gen) == ['a', 'a', 'a', 'a'])