libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
max17048.test.h
Go to the documentation of this file.
1 #include "unity.h"
2 #include "c++-alloc.h"
3 #include "libpropeller/i2c/i2c.h"
5 
7 I2C * bus;
8 
9 const int kPIN_I2C_SCL = 0;
10 const int kPIN_I2C_SDA = 1;
11 
12 class UnityTests {
13 public:
14 
15  static void setUp(void) {
16  bus = new I2C();
18  sut = new MAX17048();
19  sut->Init(bus);
20  }
21 
22  static void tearDown(void) {
23  delete bus;
24  delete sut;
25  }
26 
27  static void test_GetStatus(void) {
28  TEST_ASSERT_TRUE(sut->GetStatus());
29  }
30 
31  static void test_GetVersion(void) {
32  TEST_ASSERT_EQUAL_HEX32(0x0011, sut->GetVersion());
33  }
34 
35  static void test_GetVoltage(void) {
36  // TEST_ASSERT_EQUAL_INT_MESSAGE(-1, sut->GetVoltage(),
37  TEST_IGNORE_MESSAGE(
38  "Note: Must be manually checked. Fully charged should be about 4200.");
39  }
40 
41  static void test_GetStateOfCharge(void) {
42  // TEST_ASSERT_EQUAL_INT_MESSAGE(-1, sut->GetStateOfCharge(),
43  TEST_IGNORE_MESSAGE(
44  "Note: Must be manually checked. Fully charged should be about 100.");
45  }
46 
47  static void test_GetChargeRate(void) {
48  // TEST_ASSERT_EQUAL_INT_MESSAGE(-1, sut->GetChargeRate(),
49  TEST_IGNORE_MESSAGE(
50  "Note: Must be manually checked. Fully charged should be about 0.");
51  }
52 
53 };
54 
55 
56 
57