16 static void setUp(
void) {
22 static void tearDown(
void) {
28 static void test_Init(
void) {
29 TEST_ASSERT_EQUAL_INT(0b00111000, bus->GetPutStack());
30 TEST_ASSERT_EQUAL_INT(0b10010111, bus->GetPutStack());
31 TEST_ASSERT_EQUAL_INT(0b00000000, bus->GetPutStack());
32 TEST_ASSERT_EQUAL_INT(0b00100000, bus->GetPutStack());
33 TEST_ASSERT_EQUAL_INT(0b10011100, bus->GetPutStack());
34 TEST_ASSERT_EQUAL_INT(-1, bus->GetPutStack());
37 static void test_ReadAcclPositiveNumbers(
void) {
39 char indata[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
40 bus->SetXYZ(indata, 6);
42 TEST_ASSERT_TRUE(acclMagn.
ReadAccl(x, y, z));
44 TEST_ASSERT_EQUAL_HEX32(0x0201, x);
45 TEST_ASSERT_EQUAL_HEX32(0x0403, y);
46 TEST_ASSERT_EQUAL_HEX32(0x0605, z);
49 static void test_ReadAcclNegativeNumbers(
void) {
51 char indata[] = {0x01, 0xF2, 0x03, 0xF4, 0x05, 0xF6};
52 bus->SetXYZ(indata, 6);
54 TEST_ASSERT_TRUE(acclMagn.
ReadAccl(x, y, z));
56 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF201, x);
57 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF403, y);
58 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF605, z);
61 static void test_ReadMagnPositiveNumbers(
void) {
63 char indata[] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
64 bus->SetXYZ(indata, 6);
66 TEST_ASSERT_TRUE(acclMagn.
ReadMagn(x, y, z));
68 TEST_ASSERT_EQUAL_HEX32(0x010, x);
69 TEST_ASSERT_EQUAL_HEX32(0x030, y);
70 TEST_ASSERT_EQUAL_HEX32(0x050, z);
73 static void test_ReadMagnNegativeNumbers(
void) {
75 char indata[] = {0xF1, 0xA2, 0xF3, 0xA4, 0xF5, 0xA6};
76 bus->SetXYZ(indata, 6);
78 TEST_ASSERT_TRUE(acclMagn.
ReadMagn(x, y, z));
80 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF1A, x);
81 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF3A, y);
82 TEST_ASSERT_EQUAL_HEX32(0xFFFFFF5A, z);