60 #include "Mock_rkhfwk_rdygrp.h"
61 #include "Mock_rkhassert.h"
67 int GlobalExpectCount;
68 int GlobalVerifyOrder;
69 char *GlobalOrderError;
75 MockAssertCallback(
const char*
const file,
int line,
int cmock_num_calls)
84 Mock_rkhfwk_rdygrp_Init();
90 Mock_rkhfwk_rdygrp_Verify();
91 Mock_rkhfwk_rdygrp_Destroy();
101 test_ClearAfterInit(
void)
105 rkh_rdygrp_init_Expect(0);
106 rkh_rdygrp_init_IgnoreArg_me();
107 rkh_rdygrp_isReady_ExpectAndReturn(0, 0);
108 rkh_rdygrp_isReady_IgnoreArg_me();
109 rkh_rdygrp_isReady_ExpectAndReturn(0, 0);
110 rkh_rdygrp_isReady_IgnoreArg_me();
114 TEST_ASSERT_EQUAL(0, result);
116 TEST_ASSERT_EQUAL(1, result);
120 test_SetOneActiveObjectReadyToRun(
void)
123 rui8_t prio = 1, resultPrio;
125 rkh_rdygrp_init_Expect(0);
126 rkh_rdygrp_init_IgnoreArg_me();
127 rkh_rdygrp_setReady_Expect(0, prio);
128 rkh_rdygrp_setReady_IgnoreArg_me();
129 rkh_rdygrp_isReady_ExpectAndReturn(0, 1);
130 rkh_rdygrp_isReady_IgnoreArg_me();
131 rkh_rdygrp_findHighest_ExpectAndReturn(0, prio);
132 rkh_rdygrp_findHighest_IgnoreArg_me();
137 TEST_ASSERT_EQUAL(1, result);
140 TEST_ASSERT_EQUAL(prio, resultPrio);
144 test_SetMultipleActiveObjectsReadyToRun(
void)
146 rui8_t prioA = 1, prioC = 0, prioB = 15, resultPrio;
148 rkh_rdygrp_init_Expect(0);
149 rkh_rdygrp_init_IgnoreArg_me();
150 rkh_rdygrp_setReady_Expect(0, prioA);
151 rkh_rdygrp_setReady_IgnoreArg_me();
152 rkh_rdygrp_setReady_Expect(0, prioB);
153 rkh_rdygrp_setReady_IgnoreArg_me();
154 rkh_rdygrp_setReady_Expect(0, prioC);
155 rkh_rdygrp_setReady_IgnoreArg_me();
156 rkh_rdygrp_findHighest_ExpectAndReturn(0, prioC);
157 rkh_rdygrp_findHighest_IgnoreArg_me();
165 TEST_ASSERT_EQUAL(prioC, resultPrio);
169 test_SetOneActiveObjectUnready(
void)
172 rui8_t prio = 1, resultPrio;
174 rkh_rdygrp_init_Expect(0);
175 rkh_rdygrp_init_IgnoreArg_me();
176 rkh_rdygrp_setReady_Expect(0, prio);
177 rkh_rdygrp_setReady_IgnoreArg_me();
178 rkh_rdygrp_findHighest_ExpectAndReturn(0, prio);
179 rkh_rdygrp_findHighest_IgnoreArg_me();
180 rkh_rdygrp_setUnready_Expect(0, prio);
181 rkh_rdygrp_setUnready_IgnoreArg_me();
182 rkh_rdygrp_isReady_ExpectAndReturn(0, 0);
183 rkh_rdygrp_isReady_IgnoreArg_me();
188 TEST_ASSERT_EQUAL(prio, resultPrio);
192 TEST_ASSERT_EQUAL(0, result);
196 test_SetMultipleActiveObjectsUnready(
void)
199 rui8_t prioA = 1, prioC = 0, prioB = 15;
201 rkh_rdygrp_init_Expect(0);
202 rkh_rdygrp_init_IgnoreArg_me();
203 rkh_rdygrp_setReady_Expect(0, prioA);
204 rkh_rdygrp_setReady_IgnoreArg_me();
205 rkh_rdygrp_setReady_Expect(0, prioB);
206 rkh_rdygrp_setReady_IgnoreArg_me();
207 rkh_rdygrp_setReady_Expect(0, prioC);
208 rkh_rdygrp_setReady_IgnoreArg_me();
209 rkh_rdygrp_setUnready_Expect(0, prioA);
210 rkh_rdygrp_setUnready_IgnoreArg_me();
211 rkh_rdygrp_setUnready_Expect(0, prioB);
212 rkh_rdygrp_setUnready_IgnoreArg_me();
213 rkh_rdygrp_setUnready_Expect(0, prioC);
214 rkh_rdygrp_setUnready_IgnoreArg_me();
215 rkh_rdygrp_isReady_ExpectAndReturn(0, 0);
216 rkh_rdygrp_isReady_IgnoreArg_me();
227 TEST_ASSERT_EQUAL(0, result);
231 test_Fails_InvalidActiveObjectOnSet(
void)
235 rkh_rdygrp_init_Expect(0);
236 rkh_rdygrp_init_IgnoreArg_me();
238 rkh_assert_Expect(
"rkhsma_prio", 0);
239 rkh_assert_IgnoreArg_file();
240 rkh_assert_IgnoreArg_line();
241 rkh_assert_StubWithCallback(MockAssertCallback);
#define RKH_CFG_FWK_MAX_SMA
Specify the maximum number of state machine applications (SMA) to be used by the application (can be ...
Specifies the native priority mechanism for active object scheduling.
void rkh_smaPrio_init(void)
Initializes the native priority mechanism for active object scheduling.
void rkh_smaPrio_setUnready(rui8_t prio)
Removing an active object from the ready list.
rbool_t rkh_smaPrio_isNotReady(void)
Evaluates to true if all active objects are not ready to run.
rbool_t rkh_smaPrio_isReady(void)
Evaluates to true if any active object is ready to run.
void rkh_smaPrio_setReady(rui8_t prio)
Making an active object ready-to-run inserting it into the ready list.
rui8_t rkh_smaPrio_findHighest(void)
Finding the highest priority active object ready to run.