diff --git a/test/test_buffer.py b/test/test_buffer.py index 18d1b42..499dfd9 100644 --- a/test/test_buffer.py +++ b/test/test_buffer.py @@ -132,3 +132,14 @@ class TestBuffer: assert mpint2w(p[0]) == self._b(p[1]) assert mpint2r(self._b(p[1])) == p[0] assert mpint2r(self._b('00 00 00 02 ff 80')) == -0x80 + + def test_reset(self): + w = self.wbuf() + w.write_int(7) + w.write_int(13) + assert len(w.write_flush()) == 8 + + w.write_int(7) + w.write_int(13) + w.reset() + assert len(w.write_flush()) == 0 diff --git a/test/test_utils.py b/test/test_utils.py index d053d05..d5251f7 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -67,3 +67,10 @@ class TestUtils: assert self.utils.unique_seq((3, 3, 3, 2, 2, 1)) == (3, 2, 1) assert self.utils.unique_seq([1, 2, 2, 3, 3, 3]) == [1, 2, 3] assert self.utils.unique_seq([3, 3, 3, 2, 2, 1]) == [3, 2, 1] + + def test_parse_float(self): + assert self.utils.parse_float('5.x') == -1.0 + + def test_ipv6address(self): + assert self.utils.is_ipv6_address('1.2.3.4') is False + assert self.utils.is_ipv6_address('2600:1f18:420a:b500:bc4:c9c6:1d6:e3e4') is True