foxBMS - Unit Tests  1.1.2
The foxBMS Unit Tests API Documentation
test_sps.c
Go to the documentation of this file.
1 /**
2  *
3  * @copyright © 2010 - 2021, Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice, this
12  * list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from
20  * this software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * We kindly request you to use one or more of the following phrases to refer to
34  * foxBMS in your hardware, software, documentation or advertising materials:
35  *
36  * - ″This product uses parts of foxBMS®″
37  * - ″This product includes parts of foxBMS®″
38  * - ″This product is derived from foxBMS®″
39  *
40  */
41 
42 /**
43  * @file test_sps.c
44  * @author foxBMS Team
45  * @date 2020-10-28 (date of creation)
46  * @updated 2021-03-24 (date of last update)
47  * @ingroup UNIT_TEST_IMPLEMENTATION
48  * @prefix TEST
49  *
50  * @brief Tests for the SPS driver
51  *
52  */
53 
54 /*========== Includes =======================================================*/
55 #include "unity.h"
56 #include "Mockcontactor.h"
57 #include "Mockcontactor_cfg.h"
58 #include "Mockdatabase.h"
59 #include "Mockio.h"
60 #include "Mockmcu.h"
61 #include "Mockos.h"
62 #include "Mockspi.h"
63 #include "Mockspi_cfg.h"
64 #include "Mocksps_cfg.h"
65 #include "Mocksps_types.h"
66 
67 #include "sps.h"
68 #include "test_assert_helper.h"
69 
70 /*========== Definitions and Implementations for Unit Test ==================*/
71 /** SPI data configuration struct for SPS communication */
72 static const spiDAT1_t spi_kSpsDataConfig = {
73  /* struct is implemented in the TI HAL and uses uppercase true and false */
74  .CS_HOLD = FALSE, /*!< The HW chip select signal is deactivated */
75  .WDEL = TRUE, /*!< No delay will be inserted */
76  .DFSEL = SPI_FMT_0, /*!< Data word format select: data format 0 (SPI3) */
77  .CSNR = 0x0, /*!< Chip select (CS) number; 0x01h for CS[0] */
78 };
79 
80 /** SPI interface configuration for SPS communication */
83  .pConfig = &spi_kSpsDataConfig,
84  .pNode = spiREG3,
85  .pGioPort = &(spiREG3->PC3),
86  .csPin = 2u,
87 };
88 
89 /** channel states */
103 };
104 
105 /*========== Setup and Teardown =============================================*/
106 void setUp(void) {
107  /* make sure variables are in a known state */
108 
109  for (uint8_t channel = 0u; channel < SPS_NR_OF_AVAILABLE_SPS_CHANNELS; channel++) {
112  sps_channelStatus[channel].current_mA = 0.0f;
113  }
114 }
115 
116 void tearDown(void) {
117 }
118 
119 /*========== Test Cases =====================================================*/
122 }
123 
126 }
127 
129  OS_EnterTaskCritical_Ignore();
130  OS_ExitTaskCritical_Ignore();
131 
132  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channelRequested);
134  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channelRequested);
136  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channelRequested);
137 }
138 
141 }
142 
144  OS_EnterTaskCritical_Ignore();
145  OS_ExitTaskCritical_Ignore();
146 
148 
149  TEST_ASSERT_EQUAL(CONT_SWITCH_OFF, SPS_GetChannelFeedback(0u));
150 }
151 
153  OS_EnterTaskCritical_Ignore();
154  OS_ExitTaskCritical_Ignore();
155 
156  sps_channelStatus[0].current_mA = 600.f;
157 
158  TEST_ASSERT_EQUAL(CONT_SWITCH_ON, SPS_GetChannelFeedback(0u));
159 }
160 
163 }
164 
166  for (SPS_CHANNEL_INDEX index = 0u; index < SPS_NR_OF_AVAILABLE_SPS_CHANNELS; index++) {
167  TEST_ASSERT_EQUAL(sps_channelStatus[index].affiliation, SPS_GetChannelAffiliation(index));
168  }
169 }
170 
172  /* watch out, the channel here has to have an affiliation that is not SPS_AFF_CONTACTOR */
174 }
175 
177  /* a wrong index should also lead here to an assertion */
179 }
180 
182  OS_EnterTaskCritical_Ignore();
183  OS_ExitTaskCritical_Ignore();
184  /* watch out, the channel here has to have an affiliation that is SPS_AFF_CONTACTOR */
186  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channelRequested);
187 }
188 
190  /* watch out, the channel here has to have an affiliation that is not SPS_AFF_GENERAL_IO */
192 }
193 
195  /* a wrong index should also lead here to an assertion */
197 }
198 
200  OS_EnterTaskCritical_Ignore();
201  OS_ExitTaskCritical_Ignore();
202  /* watch out, the channel here has to have an affiliation that is SPS_AFF_GENERAL_IO */
204  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[11u].channelRequested);
205 }
206 
208  /* default wait time */
209  const uint8_t defaultTimer = 5u;
210 
211  /* check that we init in SPS_START otherwise this test has to be adapted */
212  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
213  TEST_ASSERT_EQUAL(0u, TEST_SPS_GetSpsTimer());
214 
215  /* transition through state-machine: SPS_START */
216  /* interface should become switched to low speed */
217  SPI_SpsInterfaceSwitchToLowSpeed_Expect(&spi_spsInterface);
218  SPS_Ctrl();
219  TEST_ASSERT_EQUAL(SPS_RESET_LOW, TEST_SPS_GetSpsState());
220 
221  /* transition through state-machine: SPS_RESET_LOW */
222  /* check that reset pin is reset
223  (we don't care for the actual address as long as the pin is correct) */
224  IO_PinReset_Expect(0u, SPS_RESET_PIN);
225  IO_PinReset_IgnoreArg_pRegisterAddress();
226  SPS_Ctrl();
227  /* timer should now be set to 5 */
228  TEST_ASSERT_EQUAL(defaultTimer, TEST_SPS_GetSpsTimer());
229  /* state should now be SPS_RESET_HIGH */
230  TEST_ASSERT_EQUAL(SPS_RESET_HIGH, TEST_SPS_GetSpsState());
231  /* test that timer decreases and nothing else happens */
232  SPS_Ctrl();
233  TEST_ASSERT_EQUAL((defaultTimer - 1u), TEST_SPS_GetSpsTimer());
234  TEST_ASSERT_EQUAL(SPS_RESET_HIGH, TEST_SPS_GetSpsState());
235  /* now that we know that it works: overwrite the timer so that
236  the next step can proceed */
238 
239  /* transition through state-machine: SPS_RESET_HIGH */
240  /* check that reset pin is set
241  (we don't care for the actual address as long as the pin is correct) */
242  IO_PinSet_Expect(0u, SPS_RESET_PIN);
243  IO_PinSet_IgnoreArg_pRegisterAddress();
244  SPS_Ctrl();
245  /* timer should now be set to 5 */
246  TEST_ASSERT_EQUAL(defaultTimer, TEST_SPS_GetSpsTimer());
247  /* state should now be SPS_CONFIGURE_CONTROL_REGISTER */
249  /* reset the timer so that we can continue */
251 
252  /* transition through state-machine: SPS_CONFIGURE_CONTROL_REGISTER */
253  /* check that we transmit the first set of commands */
254  SPI_TransmitReceiveData_IgnoreAndReturn(STD_OK);
255  MCU_delay_us_Ignore();
256  /* Since the transaction is successful, we should switch to high-speed */
257  SPI_SpsInterfaceSwitchToHighSpeed_Expect(&spi_spsInterface);
258  SPS_Ctrl();
259  /* state should be now SPS_TRIGGER_CURRENT_MEASUREMENT */
261 }
262 
264  /* go to state SPS_TRIGGER_CURRENT_MEASUREMENT */
266 
267  /* run state and let first transaction "fail" */
268  MCU_delay_us_Ignore();
269  SPI_TransmitReceiveData_ExpectAndReturn(NULL_PTR, NULL_PTR, NULL_PTR, 0u, STD_NOT_OK);
270  SPI_TransmitReceiveData_IgnoreArg_pSpiInterface();
271  SPI_TransmitReceiveData_IgnoreArg_pTxBuff();
272  SPI_TransmitReceiveData_IgnoreArg_pRxBuff();
273  SPI_TransmitReceiveData_IgnoreArg_frameLength();
274  SPI_TransmitReceiveData_ExpectAndReturn(NULL_PTR, NULL_PTR, NULL_PTR, 0u, STD_OK);
275  SPI_TransmitReceiveData_IgnoreArg_pSpiInterface();
276  SPI_TransmitReceiveData_IgnoreArg_pTxBuff();
277  SPI_TransmitReceiveData_IgnoreArg_pRxBuff();
278  SPI_TransmitReceiveData_IgnoreArg_frameLength();
279  SPS_Ctrl();
280 }
281 
283  /* go to state SPS_TRIGGER_CURRENT_MEASUREMENT */
285 
286  /* run state and let second transaction "fail" */
287  MCU_delay_us_Ignore();
288  SPI_TransmitReceiveData_ExpectAndReturn(NULL_PTR, NULL_PTR, NULL_PTR, 0u, STD_OK);
289  SPI_TransmitReceiveData_IgnoreArg_pSpiInterface();
290  SPI_TransmitReceiveData_IgnoreArg_pTxBuff();
291  SPI_TransmitReceiveData_IgnoreArg_pRxBuff();
292  SPI_TransmitReceiveData_IgnoreArg_frameLength();
293  SPI_TransmitReceiveData_ExpectAndReturn(NULL_PTR, NULL_PTR, NULL_PTR, 0u, STD_NOT_OK);
294  SPI_TransmitReceiveData_IgnoreArg_pSpiInterface();
295  SPI_TransmitReceiveData_IgnoreArg_pTxBuff();
296  SPI_TransmitReceiveData_IgnoreArg_pRxBuff();
297  SPI_TransmitReceiveData_IgnoreArg_frameLength();
298  SPS_Ctrl();
299 }
300 
302  /* go to state SPS_TRIGGER_CURRENT_MEASUREMENT */
304 
305  /* run state and let both transaction "fail" */
306  MCU_delay_us_Ignore();
307  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
308  SPS_Ctrl();
309 }
310 
312  /* go to state SPS_CONFIGURE_CONTROL_REGISTER */
314 
315  /* run state and let both transaction "fail" */
316  MCU_delay_us_Ignore();
317  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
318  SPS_Ctrl();
319  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
320 }
321 
323  /* go to state SPS_TRIGGER_CURRENT_MEASUREMENT */
325 
326  /* run state and let both transaction "fail" */
327  MCU_delay_us_Ignore();
328  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
329  SPS_Ctrl();
330  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
331 }
332 
334  /* go to state SPS_READ_EN_IRQ_PIN */
336 
337  /* run state and let both transaction "fail" */
338  MCU_delay_us_Ignore();
339  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
340  SPS_Ctrl();
341  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
342 }
343 
345  /* go to state SPS_READ_MEASURED_CURRENT1 */
347 
348  /* run state and let both transaction "fail" */
349  MCU_delay_us_Ignore();
350  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
351  SPS_Ctrl();
352  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
353 }
354 
356  /* go to state SPS_READ_MEASURED_CURRENT2 */
358 
359  /* run state and let both transaction "fail" */
360  MCU_delay_us_Ignore();
361  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
362  SPS_Ctrl();
363  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
364 }
365 
367  /* go to state SPS_READ_MEASURED_CURRENT3 */
369 
370  /* run state and let both transaction "fail" */
371  MCU_delay_us_Ignore();
372  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
373  SPS_Ctrl();
374  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
375 }
376 
378  /* go to state SPS_READ_MEASURED_CURRENT4 */
380 
381  /* run state and let both transaction "fail" */
382  MCU_delay_us_Ignore();
383  SPI_TransmitReceiveData_IgnoreAndReturn(STD_NOT_OK);
384  SPS_Ctrl();
385  TEST_ASSERT_EQUAL(SPS_START, TEST_SPS_GetSpsState());
386 }
387 
389  /* go to state SPS_TRIGGER_CURRENT_MEASUREMENT */
391 
392  /* let transactions always succeed */
393  MCU_delay_us_Ignore();
394  SPI_TransmitReceiveData_IgnoreAndReturn(STD_OK);
395 
396  /* run state chain */
397  SPS_Ctrl();
398  TEST_ASSERT_EQUAL(SPS_READ_EN_IRQ_PIN, TEST_SPS_GetSpsState());
399  SPS_Ctrl();
400  TEST_ASSERT_EQUAL(SPS_READ_MEASURED_CURRENT1, TEST_SPS_GetSpsState());
401  SPS_Ctrl();
402  TEST_ASSERT_EQUAL(SPS_READ_MEASURED_CURRENT2, TEST_SPS_GetSpsState());
403  SPS_Ctrl();
404  TEST_ASSERT_EQUAL(SPS_READ_MEASURED_CURRENT3, TEST_SPS_GetSpsState());
405  SPS_Ctrl();
406  TEST_ASSERT_EQUAL(SPS_READ_MEASURED_CURRENT4, TEST_SPS_GetSpsState());
407  SPS_Ctrl();
409 }
410 
412  /* go to illegal state 128 */
413  TEST_SPS_SetSpsState(128u);
414 
416 }
417 
419  OS_EnterTaskCritical_Ignore();
420  OS_ExitTaskCritical_Ignore();
421 
422  /* switch on a first, second, third and fourth channel */
423  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channelRequested);
425  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channelRequested);
426  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channel);
427 
428  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[1u].channelRequested);
430  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[1u].channelRequested);
431  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[1u].channel);
432 
433  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[6u].channelRequested);
435  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[6u].channelRequested);
436  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[6u].channel);
437 
438  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[11u].channelRequested);
440  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[11u].channelRequested);
441  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[11u].channel);
442 
443  /* cycle over one state that handles channels */
445  SPI_TransmitReceiveData_IgnoreAndReturn(STD_OK);
446  MCU_delay_us_Ignore();
447  SPS_Ctrl();
448 
449  /* check that channels have been marked as on */
450  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channel);
451  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[1u].channel);
452  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[6u].channel);
453  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[11u].channel);
454 
455  /* switch off a first, second, third and fourth channel */
456  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channelRequested);
458  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channelRequested);
459  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[0u].channel);
460 
461  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[1u].channelRequested);
463  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[1u].channelRequested);
464  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[1u].channel);
465 
466  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[6u].channelRequested);
468  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[6u].channelRequested);
469  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[6u].channel);
470 
471  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[11u].channelRequested);
473  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[11u].channelRequested);
474  TEST_ASSERT_EQUAL(SPS_CHANNEL_ON, sps_channelStatus[11u].channel);
475 
476  /* cycle over one state that handles channels */
478  SPI_TransmitReceiveData_IgnoreAndReturn(STD_OK);
479  MCU_delay_us_Ignore();
480  SPS_Ctrl();
481 
482  /* check that channels have been marked as off */
483  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[0u].channel);
484  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[1u].channel);
485  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[6u].channel);
486  TEST_ASSERT_EQUAL(SPS_CHANNEL_OFF, sps_channelStatus[11u].channel);
487 }
@ CONT_SWITCH_ON
Definition: contactor_cfg.h:72
@ CONT_SWITCH_OFF
Definition: contactor_cfg.h:71
@ STD_NOT_OK
Definition: fstd_types.h:73
@ STD_OK
Definition: fstd_types.h:72
#define NULL_PTR
Null pointer.
Definition: fstd_types.h:66
@ SPI_Interface3
Definition: spi_cfg.h:101
SPS_CHANNEL_AFFILIATION_e SPS_GetChannelAffiliation(SPS_CHANNEL_INDEX channelIndex)
Returns the channel affiliation.
Definition: sps.c:613
void TEST_SPS_RequestChannelState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Definition: sps.c:620
void SPS_Ctrl(void)
Control function for the CONT driver state machine.
Definition: sps.c:466
uint8_t TEST_SPS_GetSpsTimer(void)
Definition: sps.c:629
void TEST_SPS_SetSpsTimer(const uint8_t newTimer)
Definition: sps.c:632
void SPS_RequestGeneralIOState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Request state of a general IO.
Definition: sps.c:592
void SPS_RequestContactorState(SPS_CHANNEL_INDEX channelIndex, SPS_CHANNEL_FUNCTION_e channelFunction)
Request state of a contactor.
Definition: sps.c:587
SPS_STATE_e TEST_SPS_GetSpsState(void)
Definition: sps.c:623
void TEST_SPS_SetSpsState(const SPS_STATE_e newState)
Definition: sps.c:626
CONT_ELECTRICAL_STATE_TYPE_e SPS_GetChannelFeedback(SPS_CHANNEL_INDEX channelIndex)
Get feedback value.
Definition: sps.c:597
Headers for the driver for the smart power switches.
#define SPS_CHANNEL_ON_DEFAULT_THRESHOLD_mA
Definition: sps_cfg.h:147
#define SPS_NR_OF_AVAILABLE_SPS_CHANNELS
Definition: sps_cfg.h:82
@ SPS_CHANNEL_ON
Definition: sps_cfg.h:168
@ SPS_CHANNEL_OFF
Definition: sps_cfg.h:167
@ SPS_TRIGGER_CURRENT_MEASUREMENT
Definition: sps_cfg.h:191
@ SPS_CONFIGURE_CONTROL_REGISTER
Definition: sps_cfg.h:190
@ SPS_READ_MEASURED_CURRENT2
Definition: sps_cfg.h:193
@ SPS_READ_MEASURED_CURRENT1
Definition: sps_cfg.h:192
@ SPS_RESET_LOW
Definition: sps_cfg.h:188
@ SPS_READ_EN_IRQ_PIN
Definition: sps_cfg.h:196
@ SPS_READ_MEASURED_CURRENT3
Definition: sps_cfg.h:194
@ SPS_START
Definition: sps_cfg.h:187
@ SPS_READ_MEASURED_CURRENT4
Definition: sps_cfg.h:195
@ SPS_RESET_HIGH
Definition: sps_cfg.h:189
#define SPS_RESET_PIN
Definition: sps_cfg.h:69
uint8_t SPS_CHANNEL_INDEX
Definition: sps_types.h:63
@ SPS_AFF_CONTACTOR
Definition: sps_types.h:72
@ SPS_AFF_GENERAL_IO
Definition: sps_types.h:73
SPI_INTERFACE_e channel
Definition: spi_cfg.h:108
SPS_CHANNEL_FUNCTION_e channelRequested
Definition: sps_cfg.h:173
float current_mA
Definition: sps_cfg.h:175
SPS_CHANNEL_FUNCTION_e channel
Definition: sps_cfg.h:174
Helper for unit tests.
#define TEST_ASSERT_PASS_ASSERT(_code_under_test)
assert whether assert macro has passed
#define TEST_ASSERT_FAIL_ASSERT(_code_under_test)
assert whether assert macro has failed
void testSPS_RequestChannelStateSwitchOn(void)
Definition: test_sps.c:128
void testSPS_RequestGeneralIOStateWrongAffiliation(void)
Definition: test_sps.c:189
void testContactorSwitchOnAndOff(void)
Definition: test_sps.c:418
void testSPS_RequestContactorStateCorrectAffiliation(void)
Definition: test_sps.c:181
void testSPS_RequestChannelStateInvalidFunction(void)
Definition: test_sps.c:124
void testSPS_CtrlResetFromStateSPS_TRIGGER_CURRENT_MEASUREMENT(void)
Definition: test_sps.c:322
SPS_CHANNEL_STATE_s sps_channelStatus[SPS_NR_OF_AVAILABLE_SPS_CHANNELS]
Definition: test_sps.c:90
void testSPS_CtrlNormalOperationCycle(void)
Definition: test_sps.c:388
void testSPS_GetChannelFeedbackChannelLow(void)
Definition: test_sps.c:143
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT3(void)
Definition: test_sps.c:366
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT4(void)
Definition: test_sps.c:377
void testSPS_CtrlResetFromStateSPS_READ_EN_IRQ_PIN(void)
Definition: test_sps.c:333
void testSPS_RequestGIOStateCorrectAffiliation(void)
Definition: test_sps.c:199
void testSPS_CtrlStartupProcedure(void)
Definition: test_sps.c:207
void testSPS_GetChannelAffiliationValidIndex(void)
Definition: test_sps.c:165
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT1(void)
Definition: test_sps.c:344
void testSPS_CtrlResetOnFailedSecondTransaction(void)
Definition: test_sps.c:282
void testSPS_CtrlAssertOnIllegalState(void)
Definition: test_sps.c:411
void testSPS_RequestGeneralIOStateWrongIndex(void)
Definition: test_sps.c:194
void setUp(void)
Definition: test_sps.c:106
void tearDown(void)
Definition: test_sps.c:116
void testSPS_RequestContactorStateWrongAffiliation(void)
Definition: test_sps.c:171
void testSPS_GetChannelAffiliationInvalidIndex(void)
Definition: test_sps.c:161
void testSPS_CtrlResetOnFailedBothTransactions(void)
Definition: test_sps.c:301
void testSPS_RequestContactorStateWrongIndex(void)
Definition: test_sps.c:176
static const spiDAT1_t spi_kSpsDataConfig
Definition: test_sps.c:72
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT2(void)
Definition: test_sps.c:355
void testSPS_CtrlResetOnFailedFirstTransaction(void)
Definition: test_sps.c:263
void testSPS_GetChannelFeedbackChannelHigh(void)
Definition: test_sps.c:152
SPI_INTERFACE_CONFIG_s spi_spsInterface
Definition: test_sps.c:81
void testSPS_GetChannelFeedbackInvalidChannelIndex(void)
Definition: test_sps.c:139
void testSPS_RequestChannelStateInvalidIndex(void)
Definition: test_sps.c:120
void testSPS_CtrlResetFromStateSPS_CONFIGURE_CONTROL_REGISTER(void)
Definition: test_sps.c:311