Skip to content

Commit f628b11

Browse files
authored
test(bench): cover _uint16/_uint32_int_as_uuid and short_address (#270)
1 parent a88e0ed commit f628b11

6 files changed

Lines changed: 44 additions & 0 deletions

File tree

bench/test_short_address.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from bluetooth_data_tools import short_address
2+
3+
4+
def test_short_address_colon(benchmark):
5+
benchmark(lambda: short_address("AA:BB:CC:DD:EE:FF"))
6+
7+
8+
def test_short_address_dash(benchmark):
9+
benchmark(lambda: short_address("AA-BB-CC-DD-EE-FF"))

bench/test_uint16_int_as_uuid.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from bluetooth_data_tools.gap import _uint16_int_as_uuid
2+
3+
4+
def test_uint16_int_as_uuid_cached(benchmark):
5+
benchmark(lambda: _uint16_int_as_uuid(0x1234))

bench/test_uint32_int_as_uuid.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from bluetooth_data_tools.gap import _uint32_int_as_uuid
2+
3+
4+
def test_uint32_int_as_uuid_cached(benchmark):
5+
benchmark(lambda: _uint32_int_as_uuid(0x12345678))
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from pytest_codspeed import BenchmarkFixture
2+
3+
from bluetooth_data_tools import short_address
4+
5+
6+
def test_short_address_colon(benchmark: BenchmarkFixture) -> None:
7+
benchmark(lambda: short_address("AA:BB:CC:DD:EE:FF"))
8+
9+
10+
def test_short_address_dash(benchmark: BenchmarkFixture) -> None:
11+
benchmark(lambda: short_address("AA-BB-CC-DD-EE-FF"))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pytest_codspeed import BenchmarkFixture
2+
3+
from bluetooth_data_tools.gap import _uint16_int_as_uuid
4+
5+
6+
def test_uint16_int_as_uuid_cached(benchmark: BenchmarkFixture) -> None:
7+
benchmark(lambda: _uint16_int_as_uuid(0x1234))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pytest_codspeed import BenchmarkFixture
2+
3+
from bluetooth_data_tools.gap import _uint32_int_as_uuid
4+
5+
6+
def test_uint32_int_as_uuid_cached(benchmark: BenchmarkFixture) -> None:
7+
benchmark(lambda: _uint32_int_as_uuid(0x12345678))

0 commit comments

Comments
 (0)