foxBMS - Unit Tests  1.4.1
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 "Mockpex.h"
#include "Mockpex_cfg.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)
 
void testSPS_GetChannelPexFeedback (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]
 
const SPS_CHANNEL_FEEDBACK_MAPPING_s sps_kChannelFeedbackMapping [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
2022-10-27 (date of last update)
Version
v1.4.1
Prefix
TEST

Definition in file test_sps.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 115 of file test_sps.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 125 of file test_sps.c.

◆ testContactorSwitchOnAndOff()

void testContactorSwitchOnAndOff ( void  )

Definition at line 427 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlAssertOnIllegalState()

void testSPS_CtrlAssertOnIllegalState ( void  )

Definition at line 420 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlNormalOperationCycle()

void testSPS_CtrlNormalOperationCycle ( void  )

Definition at line 397 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 320 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 342 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 353 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 364 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 375 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 386 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 331 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedBothTransactions()

void testSPS_CtrlResetOnFailedBothTransactions ( void  )

Definition at line 310 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedFirstTransaction()

void testSPS_CtrlResetOnFailedFirstTransaction ( void  )

Definition at line 272 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlResetOnFailedSecondTransaction()

void testSPS_CtrlResetOnFailedSecondTransaction ( void  )

Definition at line 291 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_CtrlStartupProcedure()

void testSPS_CtrlStartupProcedure ( void  )

Definition at line 216 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelAffiliationInvalidIndex()

void testSPS_GetChannelAffiliationInvalidIndex ( void  )

Definition at line 170 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelAffiliationValidIndex()

void testSPS_GetChannelAffiliationValidIndex ( void  )

Definition at line 174 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackChannelHigh()

void testSPS_GetChannelFeedbackChannelHigh ( void  )

Definition at line 161 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackChannelLow()

void testSPS_GetChannelFeedbackChannelLow ( void  )

Definition at line 152 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelFeedbackInvalidChannelIndex()

void testSPS_GetChannelFeedbackInvalidChannelIndex ( void  )

Definition at line 148 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_GetChannelPexFeedback()

void testSPS_GetChannelPexFeedback ( void  )

test the states of PEX feedback function

Definition at line 499 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateInvalidFunction()

void testSPS_RequestChannelStateInvalidFunction ( void  )

Definition at line 133 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateInvalidIndex()

void testSPS_RequestChannelStateInvalidIndex ( void  )

Definition at line 129 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestChannelStateSwitchOn()

void testSPS_RequestChannelStateSwitchOn ( void  )

Definition at line 137 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateCorrectAffiliation()

void testSPS_RequestContactorStateCorrectAffiliation ( void  )

Definition at line 190 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateWrongAffiliation()

void testSPS_RequestContactorStateWrongAffiliation ( void  )

Definition at line 180 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestContactorStateWrongIndex()

void testSPS_RequestContactorStateWrongIndex ( void  )

Definition at line 185 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGeneralIOStateWrongAffiliation()

void testSPS_RequestGeneralIOStateWrongAffiliation ( void  )

Definition at line 198 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGeneralIOStateWrongIndex()

void testSPS_RequestGeneralIOStateWrongIndex ( void  )

Definition at line 203 of file test_sps.c.

Here is the call graph for this function:

◆ testSPS_RequestGIOStateCorrectAffiliation()

void testSPS_RequestGIOStateCorrectAffiliation ( void  )

Definition at line 208 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 75 of file test_sps.c.

◆ spi_spsInterface

SPI_INTERFACE_CONFIG_s spi_spsInterface
Initial value:
= {
.pConfig = &spi_kSpsDataConfig,
.pNode = spiREG3,
.pGioPort = &(spiREG3->PC3),
.csPin = 2u,
}
static const spiDAT1_t spi_kSpsDataConfig
Definition: test_sps.c:75

SPI interface configuration for SPS communication

Definition at line 84 of file test_sps.c.

◆ sps_channelStatus

◆ sps_kChannelFeedbackMapping

Initial value:
= {
}
#define PEX_PIN05
Definition: pex_cfg.h:86
#define PEX_PIN02
Definition: pex_cfg.h:83
#define PEX_PIN00
Definition: pex_cfg.h:81
#define PEX_PIN03
Definition: pex_cfg.h:84
#define PEX_PIN01
Definition: pex_cfg.h:82
#define PEX_PIN07
Definition: pex_cfg.h:88
#define PEX_PIN06
Definition: pex_cfg.h:87
#define PEX_PIN04
Definition: pex_cfg.h:85
#define PEX_PORT_EXPANDER1
Definition: pex_cfg.h:74

mapping of channel states to feedback pins

Definition at line 103 of file test_sps.c.