58 #include "Mockfassert.h"
59 #include "Mockmxm_cfg.h"
80 const uint8_t lsb = 0xFCu;
81 const uint8_t msb = 0xFFu;
82 uint16_t value = 0x00u;
84 TEST_ASSERT_EQUAL(0x3FFFu, value);
89 const uint8_t lsb = 0x10u;
90 const uint8_t msb = 0x00u;
91 uint16_t value = 0x00u;
93 TEST_ASSERT_EQUAL(1u, value);
98 const uint8_t lsb = 0x00u;
99 const uint8_t msb = 0x00u;
100 uint16_t value = 0x00u;
102 TEST_ASSERT_EQUAL(0u, value);
107 const uint8_t lsb = 0xFFu;
108 const uint8_t msb = 0x00u;
109 uint16_t value = 0x00u;
111 TEST_ASSERT_EQUAL(0xFFu, value);
116 const uint8_t lsb = 0x00u;
117 const uint8_t msb = 0xFFu;
118 uint16_t value = 0x00u;
120 TEST_ASSERT_EQUAL(0xFFu, value);
125 const uint8_t lsb = 0x00u;
126 const uint8_t msb = 0x40u;
127 uint16_t value = 0x00u;
129 TEST_ASSERT_EQUAL(1u, value);
134 const uint8_t lsb = 0xFFu;
135 const uint8_t msb = 0xFFu;
136 uint16_t value = 0x00u;
138 TEST_ASSERT_EQUAL(1u, value);
143 const uint8_t lsb = 0x00u;
144 const uint8_t msb = 0x00u;
145 uint16_t value = 0x00u;
147 TEST_ASSERT_EQUAL(0u, value);
154 uint16_t voltage = 0;
162 uint16_t voltage = 0;
164 TEST_ASSERT_EQUAL(5000u, voltage);
171 uint16_t voltage = 0;
173 TEST_ASSERT_EQUAL(0u, voltage);
180 uint16_t voltage = 0;
182 TEST_ASSERT_EQUAL(2500u, voltage);
186 fas_storeAssertLoc_Ignore();
198 TEST_ASSERT_EQUAL(0u, lsb);
199 TEST_ASSERT_EQUAL(0u, msb);
206 TEST_ASSERT_EQUAL(0xFCu, lsb);
207 TEST_ASSERT_EQUAL(0xFFu, msb);
229 TEST_ASSERT_EQUAL((0x3FFF >> 1u), value_14bit);
234 TEST_ASSERT_EQUAL(0xFCu, lsb);
235 TEST_ASSERT_EQUAL(0x7Fu, msb);
245 TEST_ASSERT_EQUAL((0x1998u >> 2u), value_14bit);
250 TEST_ASSERT_EQUAL(0x98u, lsb);
251 TEST_ASSERT_EQUAL(0x19u, msb);
255 uint16_t voltage = 5000u;
256 uint16_t voltage_result = voltage;
266 TEST_ASSERT_EQUAL(voltage, voltage_result);
270 uint16_t voltage = 0u;
271 uint16_t voltage_result = voltage;
281 TEST_ASSERT_EQUAL(voltage, voltage_result);
285 uint16_t voltage = 4200u;
286 uint16_t voltage_result = voltage;
291 TEST_ASSERT_EQUAL(0x35C1u, converted_voltage);
294 TEST_ASSERT_EQUAL(0x04u, lsb);
295 TEST_ASSERT_EQUAL(0xD7u, msb);
299 TEST_ASSERT_EQUAL(voltage, voltage_result);
307 uint8_t stringNumber = 0u;
308 uint16_t moduleNumberInString = 0u;
314 uint8_t stringNumber = 0u;
315 uint16_t moduleNumberInString = 0u;
321 uint8_t stringNumber = 0u;
322 uint16_t moduleNumberInString = 0u;
329 const uint8_t expectedStringNumber = 0u;
330 uint8_t stringNumber = 42u;
331 const uint16_t expectedModuleNumberInString = 0u;
332 uint16_t moduleNumberInString = 42u;
336 TEST_ASSERT_EQUAL(expectedStringNumber, stringNumber);
337 TEST_ASSERT_EQUAL(expectedModuleNumberInString, moduleNumberInString);
343 TEST_PASS_MESSAGE(
"This test is skipped due to the configuration of the BMS.");
345 const uint8_t expectedStringNumber = 1u;
346 uint8_t stringNumber = 0u;
347 const uint16_t expectedModuleNumberInString = 0u;
348 uint16_t moduleNumberInString = 42u;
352 TEST_ASSERT_EQUAL(expectedStringNumber, stringNumber);
353 TEST_ASSERT_EQUAL(expectedModuleNumberInString, moduleNumberInString);
359 TEST_PASS_MESSAGE(
"This test is skipped due to the configuration of the BMS.");
361 const uint8_t expectedStringNumber = 0u;
362 uint8_t stringNumber = 42u;
363 const uint16_t expectedModuleNumberInString = 1u;
364 uint16_t moduleNumberInString = 42u;
368 &moduleNumberInString));
370 TEST_ASSERT_EQUAL(expectedStringNumber, stringNumber);
371 TEST_ASSERT_EQUAL(expectedModuleNumberInString, moduleNumberInString);
377 TEST_PASS_MESSAGE(
"This test is skipped due to the configuration of the BMS.");
379 const uint8_t expectedStringNumber = 1u;
380 uint8_t stringNumber = 42u;
381 const uint16_t expectedModuleNumberInString = 1u;
382 uint16_t moduleNumberInString = 42u;
386 &moduleNumberInString));
388 TEST_ASSERT_EQUAL(expectedStringNumber, stringNumber);
389 TEST_ASSERT_EQUAL(expectedModuleNumberInString, moduleNumberInString);
#define BS_NR_OF_MODULES
number of modules in battery pack
#define NULL_PTR
Null pointer.
#define MXM_BM_LSB
Monitoring Register LSB.
#define MXM_REG_STATUS1_ALRTINTRFC
ALRTINTRFC bit in STATUS1.
#define MXM_BM_MSB
Monitoring Register MSB.
#define MXM_REG_STATUS1_ALRTRST
ALRTRST bit in STATUS1.
#define MXM_REG_ADC_14BIT_VALUE
Monitoring Register 14bit ADC value.
@ MXM_CONVERSION_UNIPOLAR
#define MXM_MAXIMUM_NR_OF_MODULES
Maximum number of modules.
#define TEST_ASSERT_PASS_ASSERT(_code_under_test)
assert whether assert macro has passed
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed