Skip to content

Commit

Permalink
add test for the program script calculate_optimal_voltages used in main
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Fiddy committed Dec 17, 2024
1 parent 0e65f80 commit 2e63783
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/program_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import numpy as np
import pytest

from bimorph_mirror_analysis.__main__ import calculate_optimal_voltages


@pytest.mark.parametrize(
["input_file", "expected_voltages"],
[["tests/data/raw_data.csv", np.array([72.14, 50.98, 18.59])]],
)
def test_calculate_optimal_voltages(
input_file: str, expected_voltages: np.typing.NDArray[np.float64]
):
voltages = calculate_optimal_voltages(input_file)
voltages = np.round(voltages, 2)
np.testing.assert_almost_equal(voltages, expected_voltages)

0 comments on commit 2e63783

Please sign in to comment.