Skip to content

Commit

Permalink
Add unit tests for power()
Browse files Browse the repository at this point in the history
  • Loading branch information
mhostetter committed Jul 11, 2024
1 parent 8bb922b commit a1913ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/measurements/test_power.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import sdr


def test_power():
rng = np.random.default_rng()
A = rng.uniform(2, 10) # Signal amplitude
N = 50
x = A * np.exp(1j * np.linspace(0, 2 * np.pi, N, endpoint=False))
assert np.allclose(sdr.power(x), A**2)


def test_peak_power():
rng = np.random.default_rng()
A = rng.uniform(2, 10) # Signal amplitude
Expand Down

0 comments on commit a1913ce

Please sign in to comment.