2020-01-23 17:21:12 -08:00
|
|
|
#include <Arduino.h>
|
2020-01-29 21:17:20 -08:00
|
|
|
#include <unity.h>
|
2023-11-27 15:13:00 -08:00
|
|
|
#include "storage.h"
|
|
|
|
#include "globals.h"
|
|
|
|
|
|
|
|
// Since it's almost impossible for the tests to clean up
|
|
|
|
// after themselves, we need to reset the global context
|
|
|
|
// prior to each test running.
|
|
|
|
//
|
|
|
|
// Since each test is (usually) testing the results of
|
|
|
|
// initialiseAll(), the flow is:
|
|
|
|
// 1. prepareForInitialise()
|
|
|
|
// 2. Set any config page values.
|
|
|
|
// 3. initialiseAll()
|
|
|
|
// 4. ASSERT on the results.
|
|
|
|
void prepareForInitialiseAll(uint8_t boardId) {
|
|
|
|
resetConfigPages();
|
|
|
|
// This is required to prevent initialiseAll() also
|
|
|
|
// calling resetConfigPages & thus blatting any
|
|
|
|
// configuration made in step 2.
|
|
|
|
configPage2.pinMapping = boardId;
|
2023-12-05 20:20:23 -08:00
|
|
|
currentStatus.initialisationComplete = false;
|
2023-11-27 15:13:00 -08:00
|
|
|
}
|
|
|
|
|
2020-01-23 17:21:12 -08:00
|
|
|
|
2023-04-26 21:43:04 -07:00
|
|
|
void testInitialisation(void);
|
|
|
|
void testFuelScheduleInit(void);
|
|
|
|
void testIgnitionScheduleInit(void);
|
2020-01-23 17:21:12 -08:00
|
|
|
|
2020-11-19 02:38:00 -08:00
|
|
|
#define UNITY_EXCLUDE_DETAILS
|
2020-02-03 14:19:43 -08:00
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
|
|
|
pinMode(LED_BUILTIN, OUTPUT);
|
|
|
|
|
2020-01-23 17:21:12 -08:00
|
|
|
// NOTE!!! Wait for >2 secs
|
|
|
|
// if board doesn't support software reset via Serial.DTR/RTS
|
|
|
|
delay(2000);
|
|
|
|
|
|
|
|
UNITY_BEGIN(); // IMPORTANT LINE!
|
|
|
|
|
2023-04-26 21:43:04 -07:00
|
|
|
testFuelScheduleInit();
|
|
|
|
testIgnitionScheduleInit();
|
2023-11-27 15:13:00 -08:00
|
|
|
testInitialisation();
|
2020-01-23 17:21:12 -08:00
|
|
|
|
2020-02-03 14:19:43 -08:00
|
|
|
UNITY_END(); // stop unit testing
|
|
|
|
}
|
2020-01-23 17:21:12 -08:00
|
|
|
|
2020-02-03 14:19:43 -08:00
|
|
|
void loop()
|
2020-01-23 17:21:12 -08:00
|
|
|
{
|
2020-02-03 14:19:43 -08:00
|
|
|
// Blink to indicate end of test
|
|
|
|
digitalWrite(LED_BUILTIN, HIGH);
|
|
|
|
delay(250);
|
|
|
|
digitalWrite(LED_BUILTIN, LOW);
|
|
|
|
delay(250);
|
2020-01-23 17:21:12 -08:00
|
|
|
}
|