foxBMS - Unit Tests  1.1.2
The foxBMS Unit Tests API Documentation
test_sps.c File Reference

Tests for the SPS driver. More...

#include "unity.h"
#include "Mockcontactor.h"
#include "Mockcontactor_cfg.h"
#include "Mockdatabase.h"
#include "Mockio.h"
#include "Mockmcu.h"
#include "Mockos.h"
#include "Mockspi.h"
#include "Mockspi_cfg.h"
#include "Mocksps_cfg.h"
#include "Mocksps_types.h"
#include "sps.h"
#include "test_assert_helper.h"
Include dependency graph for test_sps.c:

Go to the source code of this file.

Functions

void setUp (void)
 
void tearDown (void)
 
void testSPS_RequestChannelStateInvalidIndex (void)
 
void testSPS_RequestChannelStateInvalidFunction (void)
 
void testSPS_RequestChannelStateSwitchOn (void)
 
void testSPS_GetChannelFeedbackInvalidChannelIndex (void)
 
void testSPS_GetChannelFeedbackChannelLow (void)
 
void testSPS_GetChannelFeedbackChannelHigh (void)
 
void testSPS_GetChannelAffiliationInvalidIndex (void)
 
void testSPS_GetChannelAffiliationValidIndex (void)
 
void testSPS_RequestContactorStateWrongAffiliation (void)
 
void testSPS_RequestContactorStateWrongIndex (void)
 
void testSPS_RequestContactorStateCorrectAffiliation (void)
 
void testSPS_RequestGeneralIOStateWrongAffiliation (void)
 
void testSPS_RequestGeneralIOStateWrongIndex (void)
 
void testSPS_RequestGIOStateCorrectAffiliation (void)
 
void testSPS_CtrlStartupProcedure (void)
 
void testSPS_CtrlResetOnFailedFirstTransaction (void)
 
void testSPS_CtrlResetOnFailedSecondTransaction (void)
 
void testSPS_CtrlResetOnFailedBothTransactions (void)
 
void testSPS_CtrlResetFromStateSPS_CONFIGURE_CONTROL_REGISTER (void)
 
void testSPS_CtrlResetFromStateSPS_TRIGGER_CURRENT_MEASUREMENT (void)
 
void testSPS_CtrlResetFromStateSPS_READ_EN_IRQ_PIN (void)
 
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT1 (void)
 
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT2 (void)
 
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT3 (void)
 
void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT4 (void)
 
void testSPS_CtrlNormalOperationCycle (void)
 
void testSPS_CtrlAssertOnIllegalState (void)
 
void testContactorSwitchOnAndOff (void)
 

Variables

static const spiDAT1_t spi_kSpsDataConfig
 
SPI_INTERFACE_CONFIG_s spi_spsInterface
 
SPS_CHANNEL_STATE_s sps_channelStatus [SPS_NR_OF_AVAILABLE_SPS_CHANNELS]
 

Detailed Description

Tests for the SPS driver.

SPDX-License-Identifier: BSD-3-Clause

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

We kindly request you to use one or more of the following phrases to refer to foxBMS in your hardware, software, documentation or advertising materials:

  • ″This product uses parts of foxBMS®″
  • ″This product includes parts of foxBMS®″
  • ″This product is derived from foxBMS®″
Author
foxBMS Team
Date
2020-10-28 (date of creation)
Updated
2021-03-24 (date of last update)
Prefix
TEST

Definition in file test_sps.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 106 of file test_sps.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 116 of file test_sps.c.

◆ testContactorSwitchOnAndOff()

void testContactorSwitchOnAndOff ( void  )

Definition at line 418 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlAssertOnIllegalState()

void testSPS_CtrlAssertOnIllegalState ( void  )

Definition at line 411 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlNormalOperationCycle()

void testSPS_CtrlNormalOperationCycle ( void  )

Definition at line 388 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_CONFIGURE_CONTROL_REGISTER()

void testSPS_CtrlResetFromStateSPS_CONFIGURE_CONTROL_REGISTER ( void  )

Definition at line 311 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_READ_EN_IRQ_PIN()

void testSPS_CtrlResetFromStateSPS_READ_EN_IRQ_PIN ( void  )

Definition at line 333 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT1()

void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT1 ( void  )

Definition at line 344 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT2()

void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT2 ( void  )

Definition at line 355 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT3()

void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT3 ( void  )

Definition at line 366 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT4()

void testSPS_CtrlResetFromStateSPS_READ_MEASURED_CURRENT4 ( void  )

Definition at line 377 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetFromStateSPS_TRIGGER_CURRENT_MEASUREMENT()

void testSPS_CtrlResetFromStateSPS_TRIGGER_CURRENT_MEASUREMENT ( void  )

Definition at line 322 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedBothTransactions()

void testSPS_CtrlResetOnFailedBothTransactions ( void  )

Definition at line 301 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedFirstTransaction()

void testSPS_CtrlResetOnFailedFirstTransaction ( void  )

Definition at line 263 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedSecondTransaction()

void testSPS_CtrlResetOnFailedSecondTransaction ( void  )

Definition at line 282 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlStartupProcedure()

void testSPS_CtrlStartupProcedure ( void  )

Definition at line 207 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelAffiliationInvalidIndex()

void testSPS_GetChannelAffiliationInvalidIndex ( void  )

Definition at line 161 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelAffiliationValidIndex()

void testSPS_GetChannelAffiliationValidIndex ( void  )

Definition at line 165 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackChannelHigh()

void testSPS_GetChannelFeedbackChannelHigh ( void  )

Definition at line 152 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackChannelLow()

void testSPS_GetChannelFeedbackChannelLow ( void  )

Definition at line 143 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackInvalidChannelIndex()

void testSPS_GetChannelFeedbackInvalidChannelIndex ( void  )

Definition at line 139 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateInvalidFunction()

void testSPS_RequestChannelStateInvalidFunction ( void  )

Definition at line 124 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateInvalidIndex()

void testSPS_RequestChannelStateInvalidIndex ( void  )

Definition at line 120 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateSwitchOn()

void testSPS_RequestChannelStateSwitchOn ( void  )

Definition at line 128 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateCorrectAffiliation()

void testSPS_RequestContactorStateCorrectAffiliation ( void  )

Definition at line 181 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateWrongAffiliation()

void testSPS_RequestContactorStateWrongAffiliation ( void  )

Definition at line 171 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateWrongIndex()

void testSPS_RequestContactorStateWrongIndex ( void  )

Definition at line 176 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGeneralIOStateWrongAffiliation()

void testSPS_RequestGeneralIOStateWrongAffiliation ( void  )

Definition at line 189 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGeneralIOStateWrongIndex()

void testSPS_RequestGeneralIOStateWrongIndex ( void  )

Definition at line 194 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGIOStateCorrectAffiliation()

void testSPS_RequestGIOStateCorrectAffiliation ( void  )

Definition at line 199 of file test_sps.c.

Here is the call graph for this function:

Variable Documentation

◆ spi_kSpsDataConfig

const spiDAT1_t spi_kSpsDataConfig
static
Initial value:
= {
.CS_HOLD = FALSE,
.WDEL = TRUE,
.DFSEL = SPI_FMT_0,
.CSNR = 0x0,
}

SPI data configuration struct for SPS communication

Definition at line 72 of file test_sps.c.

◆ spi_spsInterface

SPI_INTERFACE_CONFIG_s spi_spsInterface
Initial value:
= {
.channel = SPI_Interface3,
.pConfig = &spi_kSpsDataConfig,
.pNode = spiREG3,
.pGioPort = &(spiREG3->PC3),
.csPin = 2u,
}
@ SPI_Interface3
Definition: spi_cfg.h:101
static const spiDAT1_t spi_kSpsDataConfig
Definition: test_sps.c:72

SPI interface configuration for SPS communication

Definition at line 81 of file test_sps.c.

◆ sps_channelStatus

Initial value:

channel states

Definition at line 90 of file test_sps.c.