Skip to content

Commit e8745f3

Browse files
committed
#221 move unit test code around for successful compilation
1 parent 2ab6578 commit e8745f3

File tree

5 files changed

+24
-18
lines changed

5 files changed

+24
-18
lines changed

test/test_core_items/DateTimeItemTestCases.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
#include "../tutils/fixtures_extern.h"
55
#include <tcUtil.h>
66

7-
void printMenuItem(MenuItem* menuItem);
8-
9-
107
RENDERING_CALLBACK_NAME_INVOKE(timeMenuItemTestCb, timeItemRenderFn, "Time", 103, NULL)
118
RENDERING_CALLBACK_NAME_INVOKE(dateFormattedTestCb, dateItemRenderFn, "Date", 999, NULL)
129

test/test_core_items/test_main.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
#include <tcm_test/testFixtures.h>
55
#include "../tutils/tcMenuFixturesExtra.h"
66

7+
const char *uuid1 = "07cd8bc6-734d-43da-84e7-6084990becfc";
8+
const char *uuid2 = "07cd8bc6-734d-43da-84e7-6084990becfd";
9+
const char *uuid3 = "07cd8bc6-734d-43da-84e7-6084990becfe";
10+
11+
NoRenderer noRenderer;
12+
MockEepromAbstraction eeprom(400);
13+
714
// core menu item tests
815
void testIpAddressItem();
916
void testSettingIpItemDirectly();

test/test_menumgr/tcMenuCoreTests.cpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <MockEepromAbstraction.h>
55
#include <MockIoAbstraction.h>
66
#include <MenuIterator.h>
7+
#include "../tutils/fixtures_extern.h"
78

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

24-
25-
void printMenuItem(MenuItem* menuItem) {
26-
if(menuItem == nullptr) {
27-
serdebugF("NULL");
28-
}
29-
else {
30-
char buffer[20];
31-
menuItem->copyNameToBuffer(buffer, sizeof buffer);
32-
serdebug3(menuItem->getId(), menuItem->getMenuType(),buffer);
33-
}
34-
}
35-
3625
bool checkMenuItem(MenuItem* actual, MenuItem* expected) {
3726
if(expected != actual) {
3827
serdebugF("Menu items are not equal: expected=");

test/test_menumgr/test_main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <unity.h>
22
#include <tcMenu.h>
3-
#include "../tutils/fixtures_extern.h"
43
#include "../tutils/tcMenuFixturesExtra.h"
54
#include <tcm_test/testFixtures.h>
5+
#include "../tutils/fixtures_extern.h"
66

77
// core tests
88
void testTcUtilGetParentAndVisit();

test/tutils/fixtures_extern.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@ extern SubMenuItem menuSettings;
3131
extern EnumMenuItem menuChannel;
3232
extern AnalogMenuItem menuVolume;
3333

34+
extern AnalogMenuItem menuSimple1;
35+
extern AnalogMenuItem menuSimple2;
36+
3437
extern int idOfCallback;
3538
extern MockEepromAbstraction eeprom;
3639

37-
void printMenuItem(MenuItem* menuItem);
38-
3940
extern const char pgmMyName[];
4041
extern NoRenderer noRenderer;
4142

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

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

49+
inline void printMenuItem(MenuItem* menuItem) {
50+
if(menuItem == nullptr) {
51+
serdebugF("NULL");
52+
}
53+
else {
54+
char buffer[20];
55+
menuItem->copyNameToBuffer(buffer, sizeof buffer);
56+
serdebug3(menuItem->getId(), menuItem->getMenuType(),buffer);
57+
}
58+
}
59+
60+
4861
#endif //TCLIBRARYDEV_FIXTURES_EXTERN_H

0 commit comments

Comments
 (0)