You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
719 B
28 lines
719 B
import pytest
|
|
|
|
from src.bm import Bm
|
|
|
|
@pytest.mark.parametrize("text,pattern,expected", [
|
|
("GCTCACTGAGCGCTCGT", "GCTCG", 11),
|
|
("GCTCACTGAGCGCTCGT", "CACTGAG", 3),
|
|
("GCTCACTGAGCGCTCGT", "AAAAA", -1),
|
|
("GCTCACTGAGCGCTCGT", "GCTCGTT", -1),
|
|
("GCTCACTGAGCGCTCGT", "GCTCACTGAGCGCTCGT", 0),
|
|
("ANPANMAN", "PAN", 2),
|
|
("ANPANMAN", "ANPAN", 0),
|
|
("ANPANMAN", "BIKINMAN", -1),
|
|
|
|
# Other useful test cases:
|
|
("ユニコード", "コード", 2),
|
|
("", "", -1),
|
|
("a", "", -1),
|
|
("", "a", -1),
|
|
("t", "too long", -1),
|
|
])
|
|
def test_bm(text, pattern, expected):
|
|
bm = Bm(text, pattern)
|
|
|
|
actual = bm.search()
|
|
|
|
assert actual == expected
|
|
# assert False # for print debugging
|