コード例 #1
0
def test_inserting_and_checking():
    simbols = {'0' , '1' , '2'}
    t = Trie(simbols)
    t.insert('00')
    t.insert('101')
    t.insert('2')
    assert not t.search('0') 
    assert t.search('00')
    assert not t.search('10')
    assert t.search('101')
    assert t.search('2')
コード例 #2
0
def test_words_init():
    simbols = {'0' , '1' , '2'}
    t = Trie(simbols, words = ['120','000','101'])
    assert t.search('120')
    assert not t.search('100')