summaryrefslogtreecommitdiff
path: root/src/drivers/test/test_battery.cpp
blob: 4a52300de47e1b672f4c6e768d54c899a94162e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "battery.hpp"

#include <cstdint>

#include "catch2/catch.hpp"

namespace drivers {

TEST_CASE("battery measurement", "[integration]") {
  Battery battery;

  SECTION("voltage is within range") {
    uint32_t mv = battery.Millivolts();
    REQUIRE(mv <= 2200);  // Plugged in, no battery.
    REQUIRE(mv >= 1000);
  }
}

}  // namespace drivers