diff options
Diffstat (limited to 'src/drivers/test/test_adc.cpp')
| -rw-r--r-- | src/drivers/test/test_adc.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/drivers/test/test_adc.cpp b/src/drivers/test/test_adc.cpp new file mode 100644 index 00000000..df103af3 --- /dev/null +++ b/src/drivers/test/test_adc.cpp @@ -0,0 +1,25 @@ +/* + * Copyright 2023 jacqueline <me@jacqueline.id.au> + * + * SPDX-License-Identifier: GPL-3.0-only + */ + +#include "drivers/adc.hpp" + +#include <cstdint> + +#include "catch2/catch.hpp" + +namespace drivers { + +TEST_CASE("battery measurement", "[integration]") { + AdcBattery battery; + + SECTION("voltage is within range") { + uint32_t mv = battery.Millivolts(); + REQUIRE(mv <= 4210); // Should never be charged above this. + REQUIRE(mv >= 3000); // Should never be discharged below this. + } +} + +} // namespace drivers |
