diff options
| author | jacqueline <me@jacqueline.id.au> | 2022-11-09 16:28:19 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2022-11-09 16:28:19 +1100 |
| commit | 37041b810fbd10aab0834a33ae1dbd9edbb8bcb9 (patch) | |
| tree | beefecd27395821204f3d11823f566f671e8a1e1 /src/drivers/test/test_battery.cpp | |
| parent | 34330daadfded8e9a421ba1d7c9ef8757ab92599 (diff) | |
| download | tangara-fw-37041b810fbd10aab0834a33ae1dbd9edbb8bcb9.tar.gz | |
Add so many tests i am going to die
Diffstat (limited to 'src/drivers/test/test_battery.cpp')
| -rw-r--r-- | src/drivers/test/test_battery.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/drivers/test/test_battery.cpp b/src/drivers/test/test_battery.cpp new file mode 100644 index 00000000..a1499e40 --- /dev/null +++ b/src/drivers/test/test_battery.cpp @@ -0,0 +1,18 @@ +#include <cstdint> +#include "battery.hpp" + +#include "catch2/catch.hpp" + +namespace drivers { + +TEST_CASE("battery measurement", "[integration]") { + REQUIRE(drivers::init_adc() == ESP_OK); + + SECTION("voltage is within range") { + uint32_t voltage = read_battery_voltage(); + REQUIRE(voltage <= 2200); // Plugged in, no battery. + REQUIRE(voltage >= 1000); + } +} + +} // namespace drivers |
