summaryrefslogtreecommitdiff
path: root/src/drivers/test/test_battery.cpp
blob: 690eb2b79b93b7a70063efa5f08193ab73d81427 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
 * Copyright 2023 jacqueline <me@jacqueline.id.au>
 *
 * SPDX-License-Identifier: GPL-3.0-only
 */

#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