Skip to content

Commit

Permalink
#221 move unit test code around for successful compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
davetcc committed Aug 24, 2024
1 parent 2ab6578 commit e8745f3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 18 deletions.
3 changes: 0 additions & 3 deletions test/test_core_items/DateTimeItemTestCases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#include "../tutils/fixtures_extern.h"
#include <tcUtil.h>

void printMenuItem(MenuItem* menuItem);


RENDERING_CALLBACK_NAME_INVOKE(timeMenuItemTestCb, timeItemRenderFn, "Time", 103, NULL)
RENDERING_CALLBACK_NAME_INVOKE(dateFormattedTestCb, dateItemRenderFn, "Date", 999, NULL)

Expand Down
7 changes: 7 additions & 0 deletions test/test_core_items/test_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
#include <tcm_test/testFixtures.h>
#include "../tutils/tcMenuFixturesExtra.h"

const char *uuid1 = "07cd8bc6-734d-43da-84e7-6084990becfc";
const char *uuid2 = "07cd8bc6-734d-43da-84e7-6084990becfd";
const char *uuid3 = "07cd8bc6-734d-43da-84e7-6084990becfe";

NoRenderer noRenderer;
MockEepromAbstraction eeprom(400);

// core menu item tests
void testIpAddressItem();
void testSettingIpItemDirectly();
Expand Down
13 changes: 1 addition & 12 deletions test/test_menumgr/tcMenuCoreTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <MockEepromAbstraction.h>
#include <MockIoAbstraction.h>
#include <MenuIterator.h>
#include "../tutils/fixtures_extern.h"

// here we set the pressMe menu item callback to our standard action callback.
void myActionCb(int id);
Expand All @@ -21,18 +22,6 @@ const char PROGMEM pgmMyName[] = "UnitTest";
int counter = 0;
const PROGMEM ConnectorLocalInfo applicationInfo = { "DfRobot", "2ba37227-a412-40b7-94e7-42caf9bb0ff4" };


void printMenuItem(MenuItem* menuItem) {
if(menuItem == nullptr) {
serdebugF("NULL");
}
else {
char buffer[20];
menuItem->copyNameToBuffer(buffer, sizeof buffer);
serdebug3(menuItem->getId(), menuItem->getMenuType(),buffer);
}
}

bool checkMenuItem(MenuItem* actual, MenuItem* expected) {
if(expected != actual) {
serdebugF("Menu items are not equal: expected=");
Expand Down
2 changes: 1 addition & 1 deletion test/test_menumgr/test_main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include <unity.h>
#include <tcMenu.h>
#include "../tutils/fixtures_extern.h"
#include "../tutils/tcMenuFixturesExtra.h"
#include <tcm_test/testFixtures.h>
#include "../tutils/fixtures_extern.h"

// core tests
void testTcUtilGetParentAndVisit();
Expand Down
17 changes: 15 additions & 2 deletions test/tutils/fixtures_extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ extern SubMenuItem menuSettings;
extern EnumMenuItem menuChannel;
extern AnalogMenuItem menuVolume;

extern AnalogMenuItem menuSimple1;
extern AnalogMenuItem menuSimple2;

extern int idOfCallback;
extern MockEepromAbstraction eeprom;

void printMenuItem(MenuItem* menuItem);

extern const char pgmMyName[];
extern NoRenderer noRenderer;

Expand All @@ -45,4 +46,16 @@ extern const char *uuid3;

bool checkEditorHints(int start, int end, CurrentEditorRenderingHints::EditorRenderingType ty);

inline void printMenuItem(MenuItem* menuItem) {
if(menuItem == nullptr) {
serdebugF("NULL");
}
else {
char buffer[20];
menuItem->copyNameToBuffer(buffer, sizeof buffer);
serdebug3(menuItem->getId(), menuItem->getMenuType(),buffer);
}
}


#endif //TCLIBRARYDEV_FIXTURES_EXTERN_H

0 comments on commit e8745f3

Please sign in to comment.