blob: d41625f98fc8c176010761533c2be2ecc80f898f (
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <ztest.h>
#include <drivers/emul.h>
#include "driver/ln9310.h"
#include "emul/emul_ln9310.h"
void test_ln9310_2s_no_startup__passes_init(void)
{
const struct emul *emulator =
emul_get_binding(DT_LABEL(DT_NODELABEL(ln9310)));
zassert_not_null(emulator, NULL);
ln9310_emul_set_context(emulator);
ln9310_emul_reset(emulator);
ln9310_emul_set_battery_cell_type(emulator, BATTERY_CELL_TYPE_2S);
ln9310_emul_set_version(emulator, LN9310_BC_STS_C_CHIP_REV_FIXED);
zassert_ok(ln9310_init(), NULL);
}
void test_ln9310_3s_no_startup__passes_init(void)
{
const struct emul *emulator =
emul_get_binding(DT_LABEL(DT_NODELABEL(ln9310)));
zassert_not_null(emulator, NULL);
ln9310_emul_set_context(emulator);
ln9310_emul_reset(emulator);
ln9310_emul_set_battery_cell_type(emulator, BATTERY_CELL_TYPE_3S);
ln9310_emul_set_version(emulator, LN9310_BC_STS_C_CHIP_REV_FIXED);
zassert_ok(ln9310_init(), NULL);
}
void test_suite_ln9310(void)
{
ztest_test_suite(
ln9310,
ztest_unit_test(test_ln9310_2s_no_startup__passes_init),
ztest_unit_test(test_ln9310_3s_no_startup__passes_init));
ztest_run_test_suite(ln9310);
}
|