Skip to content

Commit

Permalink
TST: A little update to the dB tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Feb 10, 2019
1 parent b676d2f commit 059410f
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,20 @@ def test_direction_vector(input, vector):

db_data = [
(0, -np.inf),
(0.5, -3.01029995663981),
(1, 0),
(2, 3.01029995663981),
(10, 10),
(10 * 2, (10 + 3.010299956639813)),
(10 * 10, (10 + 10)),
(10 * 3, (10 + 4.771212547196624)),
(10 * 4, (10 + 6.02059991327962)),
(10 * 0.5, (10 - 3.01029995663981198)),
(10 * 0.1, (10 - 10)),
(10 * 0.25, (10 - 6.02059991327962396))
]
]


@pytest.mark.parametrize('linear, decibel', db_data)
def test_db_amplitude(linear, decibel):
d = sfs.util.db(linear, True)
assert_allclose(d, decibel)
@pytest.mark.parametrize('linear, power_db', db_data)
def test_db_amplitude(linear, power_db):
d = sfs.util.db(linear)
assert_allclose(d, power_db * 2)


@pytest.mark.parametrize('linear, decibel', db_data)
def test_db_power(linear, decibel):
d = sfs.util.db(linear)
assert_allclose(d, 2 * decibel)
@pytest.mark.parametrize('linear, power_db', db_data)
def test_db_power(linear, power_db):
d = sfs.util.db(linear, power=True)
assert_allclose(d, power_db)

0 comments on commit 059410f

Please sign in to comment.