Starting test-driven development (TDD) with Unity
- Using PlatformIO's embedded unit testing with native environment - mbed-dependent .cpp files escaped with #ifndef UNIT_TEST - First tests for charger module added under test/ directory
This commit is contained in:
+6
-2
@@ -16,9 +16,9 @@
|
||||
|
||||
#include "pcb.h"
|
||||
#include "thingset.h"
|
||||
#include "mbed.h"
|
||||
#include "eeprom.h"
|
||||
#include <inttypes.h>
|
||||
#include <time.h>
|
||||
|
||||
// versioning of EEPROM layout (2 bytes)
|
||||
// change the version number each time the data object array below is changed!
|
||||
@@ -43,6 +43,8 @@ const uint16_t eeprom_data_objects[] = {
|
||||
0xA6 // day count
|
||||
};
|
||||
|
||||
#ifndef UNIT_TEST
|
||||
|
||||
uint32_t _calc_crc(uint8_t *buf, size_t len)
|
||||
{
|
||||
RCC->AHBENR |= RCC_AHBENR_CRCEN;
|
||||
@@ -66,6 +68,8 @@ uint32_t _calc_crc(uint8_t *buf, size_t len)
|
||||
return CRC->DR;
|
||||
}
|
||||
|
||||
#endif // UNIT_TEST
|
||||
|
||||
#if defined(PIN_EEPROM_SDA) && defined(PIN_EEPROM_SCL)
|
||||
|
||||
#ifdef PCB_LS_010
|
||||
@@ -284,4 +288,4 @@ void eeprom_update()
|
||||
if (time(NULL) % EEPROM_UPDATE_INTERVAL == 0 && time(NULL) > 0) {
|
||||
eeprom_store_data();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user