summaryrefslogtreecommitdiff
path: root/src/drivers/test/test_adc.cpp
blob: a8dad4bdfcfd5d06688e707a766a8945a7890e5d (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 "drivers/adc.hpp"

#include <cstdint>

#include "catch2/catch.hpp"

namespace drivers {

TEST_CASE("battery adc", "[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