Esempio n. 1
0
def test_read_hybrid():
    b = Buffer()
    assert b.feed("rock and") == None
    b.set_term("\r\n")
    assert b.feed(" roll\r") == None
    assert b.feed("\n012345678") == "rock and roll\r\n"
    b.set_term(16)
    assert b.check() == None
    assert b.feed("9abcdefgh") == "0123456789abcdef"
Esempio n. 2
0
def test_read_hybrid():
    b = Buffer()
    assert b.feed("rock and") == None
    b.set_term("\r\n")
    assert b.feed(" roll\r") == None
    assert b.feed("\n012345678") == "rock and roll\r\n"
    b.set_term(16)
    assert b.check() == None
    assert b.feed("9abcdefgh") == "0123456789abcdef"
Esempio n. 3
0
def test_read_sentinel():
    b = Buffer()
    assert b.feed("rock and") == None
    b.set_term("\r\n")
    assert b.feed(" roll\r") == None
    assert b.feed("\nrock ") == "rock and roll\r\n"
    assert b.feed("and roll 2\r\n") == None
    b.set_term("\r\n")
    assert b.check() == "rock and roll 2\r\n"
Esempio n. 4
0
def test_read_sentinel():
    b = Buffer()
    assert b.feed("rock and") == None
    b.set_term("\r\n")
    assert b.feed(" roll\r") == None
    assert b.feed("\nrock ") == "rock and roll\r\n"
    assert b.feed("and roll 2\r\n") == None
    b.set_term("\r\n")
    assert b.check() == "rock and roll 2\r\n"
Esempio n. 5
0
def test_read_hybrid():
    b = Buffer()
    WVPASS(b.feed("rock and") == None)
    b.set_term("\r\n")
    WVPASS(b.feed(" roll\r") == None)
    WVPASS(b.feed("\n012345678") == "rock and roll\r\n")
    b.set_term(16)
    WVPASS(b.check() == None)
    WVPASS(b.feed("9abcdefgh") == "0123456789abcdef")
Esempio n. 6
0
def test_read_sentinel():
    b = Buffer()
    WVPASS(b.feed("rock and") == None)
    b.set_term("\r\n")
    WVPASS(b.feed(" roll\r") == None)
    WVPASS(b.feed("\nrock ") == "rock and roll\r\n")
    WVPASS(b.feed("and roll 2\r\n") == None)
    b.set_term("\r\n")
    WVPASS(b.check() == "rock and roll 2\r\n")
Esempio n. 7
0
def test_read_bytes():
    b = Buffer()
    b.set_term(10)
    assert b.feed("rock") == None
    assert b.feed("rockandroll") == "rockrockan"
    # buffer left.. droll
    assert b.check() == None
    b.set_term(10)
    assert b.check() == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == "drollrrrrr"
    assert b.feed("x" * 10000) == None # no term (re-)established
Esempio n. 8
0
def test_read_bytes():
    b = Buffer()
    b.set_term(10)
    assert b.feed("rock") == None
    assert b.feed("rockandroll") == "rockrockan"
    # buffer left.. droll
    assert b.check() == None
    b.set_term(10)
    assert b.check() == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == None
    assert b.feed("r") == "drollrrrrr"
    assert b.feed("x" * 10000) == None  # no term (re-)established
Esempio n. 9
0
def test_read_bytes():
    b = Buffer()
    b.set_term(10)
    WVPASS(b.feed("rock") == None)
    WVPASS(b.feed("rockandroll") == "rockrockan")
    # buffer left.. droll
    WVPASS(b.check() == None)
    b.set_term(10)
    WVPASS(b.check() == None)
    WVPASS(b.feed("r") == None)
    WVPASS(b.feed("r") == None)
    WVPASS(b.feed("r") == None)
    WVPASS(b.feed("r") == None)
    WVPASS(b.feed("r") == "drollrrrrr")
    WVPASS(b.feed("x" * 10000) == None) # no term (re-)established