ccNOos  v0.0.0
Build Portable Microcontroller Applications!
Application_Solution.h
Go to the documentation of this file.
1 /** \file ccNOos_tests.h
2 * \brief Cross-Platform Portable ccNOos Tests Declarations
3 
4  Copyright 2021 InMechaSol, Inc
5 
6  Licensed under the Apache License, Version 2.0 (the "License");
7  you may not use this file except in compliance with the License.
8  You may obtain a copy of the License at
9 
10  http://www.apache.org/licenses/LICENSE-2.0
11 
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  See the License for the specific language governing permissions and
16  limitations under the License.
17 
18 Notes:
19 
20 This header demonstrates the usage of the ccNOos library and its dependence
21 on other files in the library. A platform specific main(.c,.cpp) file need
22 only include this single header to implement a platform specific ccNOos_tests
23 application.
24 
25 */
26 #ifndef __CCNOOS_TESTS__
27 #define __CCNOOS_TESTS__
28 
29 #include "../../../executionSystem/execution_system.h"
30 #include "../../../consoleMenu/console_menu.h"
31 
32 #define Mn ccNOosTests
33 
34 #define charBuffMax 80
35 
37 {
39  float float_0, float_1;
40  double double_0, double_1;
41  UI_64 ui64_0, ui64_1;
42  I_64 i64_0, i64_1;
43  UI_32 ui32_0, ui32_1;
44  I_32 i32_0, i32_1;
45  UI_16 ui16_0, ui16_1;
46  I_16 i16_0, i16_1;
47  UI_8 ui8_0, ui8_1;
48  I_8 i8_0, i8_1;
49  UI_8 charsRead, chars2Write;
50  char charbuff_In[charBuffMax];
51  char charbuff_Out[charBuffMax];
52  UI_16 SerializationTestReturn;
53  UI_16 TimedExecutionTestReturn;
54  UI_16 ExceptionsTestReturn;
55  UI_16 TestState;
56 };
57 
58 #define MODdeclareCREATEINS
59 #define MODcallCREATEINS
60 
62 
63 // Re-usable, portable, cross-platform (ccNOosTests setup() function)
65 // Re-usable, portable, cross-platform (ccNOosTests loop() function)
67 // Re-usable, portable, cross-platform (ccNOosTests systick() function)
69 #ifdef __USINGCONSOLEMENU
72 #endif
73 ///////////////////////////////////////////////////////////////////////
74 // Test Function Return Value Constants
75 #define RETURN_TEST_PASSED (0x0000)
76 #define RETURN_TEST_IN_PROGRESS (0x0001)
77 #define RETURN_FAILED_TIMEDEXECUTION (0x0010)
78 #define RETURN_FAILED_SERIALIZATION (0x0100)
79 #define RETURN_FAILED_DESERIALIZATION (0x0110)
80 #define RETURN_FAILED_COMPARISON (0x0120)
81 
82 ///////////////////////////////////////////////////////////////////////
83 // Test Functions
86 #ifdef __USINGCONSOLEMENU
87 UI_16 SerializationTest(MODdeclarePTRIN(Mn));
88 const char* ResultsSerializationTests(MODdeclarePTRIN(Mn));
89 const char* ResultsTimedExecutionTests(MODdeclarePTRIN(Mn));
90 const char* StatusccNOosTests(MODdeclarePTRIN(Mn));
91 #endif
92 
93 ////////////////////////////////////////////////////////////////////////////////
94 // C ccNOosTests Example Application - built from computeModuleClass and Execution System
95 #define __PLATFORM_APP_CTEMPLATE(MODNAME) \
96  struct linkedEntryPointStruct setupListHead = {\
97  nullptr,\
98  (struct computeModuleStruct*)&MODdataINST(Mn),\
99  MODsetup(Mn)\
100  };\
101  struct linkedEntryPointStruct loopListHead = {\
102  nullptr,\
103  (struct computeModuleStruct*)&MODdataINST(Mn),\
104  MODloop(Mn)\
105  };\
106  struct executionEntryStruct exeEntryPoints = {\
107  &setupListHead,\
108  &loopListHead,\
109  nullptr,\
110  &setupListHead\
111  };\
112  void applicationConfig()\
113  {\
114  exeSystem = CreateExecutionSystemStruct(uSEC_PER_CLOCK);\
115  MODdataINST(Mn) = MODstructCREATE(Mn)();\
116  }
117 #define PLATFORM_APP_CTEMPLATE(MODNAME) __PLATFORM_APP_CTEMPLATE(MODNAME)
118 
119 #ifdef __cplusplus
120 ////////////////////////////////////////////////////////////////////////////////
121 // C++ ccNOosTests Example Class - built from computeModuleClass
122 class MODCLASS_NAME(Mn) : public computeModuleClass {
123 private:
125 public:
127  MODCLASS_SETUP_INLINE(Mn);
128  MODCLASS_LOOP_INLINE(Mn);
129  MODCLASS_SYSTICK_INLINE(Mn);
130  MODCLASS_ExcpHndlr_INLINE(Mn);
131 };
132 
133 ////////////////////////////////////////////////////////////////////////////////
134 // C++ ccNOosTests Example Application - built from computeModuleClass and Execution System
135 #define __PLATFORM_APP_CLASS(MODNAME) class theApplicationClass{\
136  public:\
137  linkedEntryPointClass setupListHead;\
138  linkedEntryPointClass loopListHead;\
139  linkedEntryPointClass systickListHead;\
140  linkedEntryPointClass exceptionListHead;\
141  MODCLASS_NAME(MODNAME) MODNAME##CompMod;\
142  executionSystemClass* theExecutionSystemPtr;\
143  theApplicationClass() :\
144  MODNAME##CompMod(),\
145  setupListHead(& MODNAME##CompMod, nullptr),\
146  loopListHead(& MODNAME##CompMod, nullptr),\
147  systickListHead(nullptr, nullptr),\
148  exceptionListHead(&MODNAME##CompMod, nullptr)\
149  {\
150  theExecutionSystemPtr = &exeSystem;\
151  theExecutionSystemPtr->LinkTheListsHead(\
152  &setupListHead,\
153  &loopListHead,\
154  &systickListHead,\
155  &exceptionListHead\
156  );\
157  }\
158 }
159 #define PLATFORM_APP_CLASS(MODNAME) __PLATFORM_APP_CLASS(MODNAME)
160 
161 
162 #endif // !__cplusplus
163 
164 #endif // !__CCNOOS_TESTS__
charBuffMax
#define charBuffMax
Definition: Application_Solution.h:34
MODdeclarePTRIN
#define MODdeclarePTRIN(mNAME)
Definition: version_config.h:284
MODdeclareLOOP
MODdeclareLOOP(Mn)
Definition: Application_Solution.c:116
Mn
#define Mn
Definition: Application_Solution.h:32
COMPMODFIRST
#define COMPMODFIRST
Definition: version_config.h:280
TimedExecutionTest
UI_16 TimedExecutionTest(MODdeclarePTRIN(Mn))
Definition: Application_Solution.c:376
MODdeclarePRINTm
MODdeclarePRINTm(Mn)
Definition: Application_Solution.c:109
MODdeclarePARSEi
MODdeclarePARSEi(Mn)
Definition: Application_Solution.c:161
MODdeclareCREATEINS
#define MODdeclareCREATEINS
Definition: Application_Solution.h:58
MODdeclareSETUP
MODdeclareSETUP(Mn)
Definition: Application_Solution.c:79
MODCLASS_NAME
MODCLASS_NAME(Mn)
Definition: Application_Solution.cpp:34
MODdeclareCREATE
#define MODdeclareCREATE(mNAME)
Definition: version_config.h:292
MODdeclareSYSTICK
MODdeclareSYSTICK(Mn)
Definition: Application_Solution.c:157
ExceptionsTest
UI_16 ExceptionsTest(MODdeclarePTRIN(Mn))
Definition: Application_Solution.c:403
MODdeclareDATA
#define MODdeclareDATA(mNAME)
Definition: version_config.h:288
MODdeclareSTRUCT
MODdeclareSTRUCT(Mn)
Definition: Application_Solution.h:36