Skip to content

Commit

Permalink
implemented deleteFile()
Browse files Browse the repository at this point in the history
  • Loading branch information
barry-ha committed Apr 8, 2023
1 parent fa1a298 commit be94406
Showing 1 changed file with 48 additions and 42 deletions.
90 changes: 48 additions & 42 deletions unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,12 @@ int testNextGridLineEast(float fExpected, double fLongitude) {
int r = 0;
float result = grid.nextGridLineEast(fLongitude);
// clang off
Serial.print("Grid Crossing East: given = "); ~Serial.print(fLongitude);
Serial.print(", expected = "); ~Serial.print(fExpected);
Serial.print(", result = "); ~Serial.print(result);
Serial.print("Grid Crossing East: given = ");
~Serial.print(fLongitude);
Serial.print(", expected = ");
~Serial.print(fExpected);
Serial.print(", result = ");
~Serial.print(result);
// clang on
if (result == fExpected) {
~Serial.println("");
Expand All @@ -223,9 +226,12 @@ int testNextGridLineWest(float fExpected, double fLongitude) {
int r = 0;
float result = grid.nextGridLineWest(fLongitude);
// clang off
Serial.print("Grid Crossing West: given = "); Serial.print(fLongitude);
Serial.print(", expected = "); Serial.print(fExpected);
Serial.print(", result = "); Serial.print(result);
Serial.print("Grid Crossing West: given = ");
Serial.print(fLongitude);
Serial.print(", expected = ");
Serial.print(fExpected);
Serial.print(", result = ");
Serial.print(result);
// clang on
if (result == fExpected) {
Serial.println("");
Expand Down Expand Up @@ -398,7 +404,7 @@ int verifySaveRestoreVolume() {
Serial.println("ERROR! Unable to restore integer from SDRAM");
fails++;
}
configWrite.remove(TEST_CONFIG_FILE);
configWrite.deleteFile(TEST_CONFIG_FILE);
return fails;
}

Expand Down Expand Up @@ -447,7 +453,7 @@ int verifySaveRestoreArray() {
Serial.println("ERROR! Unable to restore from SDRAM");
fails++;
}
writeArray.remove(TEST_ARRAY_FILE);
writeArray.deleteFile(TEST_ARRAY_FILE);
return fails;
}
// =============================================================
Expand Down Expand Up @@ -491,7 +497,7 @@ int verifyBreadCrumbs() {
model->gLongitude = -122.274711; // CN87

// reduce the frequency of saving to memory
trail.saveInterval = 20; // 100; // default 2 is too often
trail.saveInterval = 20; // 100; // default 2 is too often

// initialize the canvas that we will draw upon
gridView.startScreen(); // clear and draw normal screen
Expand Down Expand Up @@ -545,8 +551,8 @@ int verifyBreadCrumbTrail1() {
float stepSize = 15.0 / 250.0; // number of degrees to move each loop

trail.clearHistory();
trail.rememberPUP(); // test "power up" record type

trail.rememberPUP(); // test "power up" record type

// test GPS record type
for (int ii = 0; ii < steps; ii++) {
Expand Down Expand Up @@ -750,37 +756,37 @@ void runUnitTest() {
delay(1000);

int f = 0;
/*****
f += verifyNMEAtime(); // verify conversions from GPS' time (NMEA) to time_t
countDown(5); //
f += verifyCalcTimeDiff(); // verify human-friendly time intervals
countDown(5); //
f += verifyMorseCode(); // verify Morse code
f += verifySaveRestoreVolume(); // verify save/restore an integer setting in SDRAM
countDown(5); //
f += verifySaveRestoreArray(); // verify save/restore an array in SDRAM
countDown(5); //
f += verifySaveRestoreGPSModel(); // verify save/restore GPS model state in SDRAM
countDown(5); //
f += verifyBreadCrumbs(); // verify pushpins near the four corners
countDown(5); //
*****/
f += verifyBreadCrumbTrail1(); // verify painting the bread crumb trail
countDown(5); //
f += verifyBreadCrumbTrail2(); // verify painting the bread crumb trail
countDown(5); //
f += verifySaveTrail(); // save GPS route to non-volatile memory
countDown(5); //
f += verifyRestoreTrail(); // restore GPS route from non-volatile memory
countDown(5); //
/*****
f += verifyDerivingGridSquare(); // verify deriving grid square from lat-long coordinates
countDown(5); //
f += verifyComputingDistance(); // verify computing distance
f += verifyComputingGridLines(); // verify finding grid lines on E and W
countDown(5); // give user time to inspect display appearance for unit test problems
*****/
trail.clearHistory(); // clean up our mess after unit test
/*****
f += verifyNMEAtime(); // verify conversions from GPS' time (NMEA) to time_t
countDown(5); //
f += verifyCalcTimeDiff(); // verify human-friendly time intervals
countDown(5); //
f += verifyMorseCode(); // verify Morse code
f += verifySaveRestoreVolume(); // verify save/restore an integer setting in SDRAM
countDown(5); //
f += verifySaveRestoreArray(); // verify save/restore an array in SDRAM
countDown(5); //
f += verifySaveRestoreGPSModel(); // verify save/restore GPS model state in SDRAM
countDown(5); //
f += verifyBreadCrumbs(); // verify pushpins near the four corners
countDown(5); //
*****/
f += verifyBreadCrumbTrail1(); // verify painting the bread crumb trail
countDown(5); //
f += verifyBreadCrumbTrail2(); // verify painting the bread crumb trail
countDown(5); //
f += verifySaveTrail(); // save GPS route to non-volatile memory
countDown(5); //
f += verifyRestoreTrail(); // restore GPS route from non-volatile memory
countDown(5); //
/*****
f += verifyDerivingGridSquare(); // verify deriving grid square from lat-long coordinates
countDown(5); //
f += verifyComputingDistance(); // verify computing distance
f += verifyComputingGridLines(); // verify finding grid lines on E and W
countDown(5); // give user time to inspect display appearance for unit test problems
*****/
trail.clearHistory(); // clean up our mess after unit test
trail.rememberPUP();

logger.fencepost("unittest.cpp", "End Unit Test", __LINE__);
Expand Down

0 comments on commit be94406

Please sign in to comment.