foxBMS - Unit Tests  1.2.0
The foxBMS Unit Tests API Documentation
test_mxm_17841b.c File Reference

Test for the Maxim MAX17841B driver. More...

#include "unity.h"
#include "Mockfassert.h"
#include "Mockmxm_cfg.h"
#include "mxm_17841b.h"
#include "mxm_bitextract.h"
#include "test_assert_helper.h"
Include dependency graph for test_mxm_17841b.c:

Go to the source code of this file.

Functions

void setUp (void)
 
void tearDown (void)
 
void testOnlyAllowedTransitionFromUnitializedIsInit (void)
 
void testTransitionsOnlyAllowedInIdleAfterInit (void)
 
void testStateRequestConsistentInput (void)
 
void testStateRequestInconsistentInputPayload (void)
 
void testStateRequestInconsistentInputRXBuffer (void)
 
void testStateRequestInconsistentInputProcessed (void)
 
void testWriteRegisterFunctionWithIllegalValues (void)
 
void testWriteRegisterFunctionWithLegalValues (void)
 
void testReadRegisterFunctionWithIllegalValues (void)
 
void testReadRegisterFunctionWithLegalValues (void)
 
void testStateStayInUninitialized (void)
 
void testStateStayInIdle (void)
 
void testStateCheckFMEA (void)
 
void testStateCheckFMEAGNDLAlert (void)
 
void testStateGetVersion (void)
 
void testStateClearReceiveBuffer (void)
 
void testStateClearReceiveBufferFailedSPIWrite (void)
 
void testStateClearTransmitBuffer (void)
 
void testStateClearTransmitBufferFailedSPIWrite (void)
 
void testStateUARTWaitForRXStatusChangeFail (void)
 
void testStateUARTWaitForRXStatusChangeSuccess (void)
 

Variables

static MXM_41B_INSTANCE_s mxm_41b_state
 
uint16_t commandBuffer [10] = {0}
 
uint16_t rxBuffer [100] = {0}
 
MXM_41B_STATE_REQUEST_STATUS_e status41b = MXM_41B_STATE_UNPROCESSED
 

Detailed Description

Test for the Maxim MAX17841B 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-06-22 (date of creation)
Updated
2021-06-16 (date of last update)
Prefix
MXM

def

Definition in file test_mxm_17841b.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 91 of file test_mxm_17841b.c.

◆ tearDown()

void tearDown ( void  )

Definition at line 121 of file test_mxm_17841b.c.

◆ testOnlyAllowedTransitionFromUnitializedIsInit()

void testOnlyAllowedTransitionFromUnitializedIsInit ( void  )

Definition at line 127 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testReadRegisterFunctionWithIllegalValues()

void testReadRegisterFunctionWithIllegalValues ( void  )

Definition at line 275 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testReadRegisterFunctionWithLegalValues()

void testReadRegisterFunctionWithLegalValues ( void  )

Definition at line 281 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateCheckFMEA()

void testStateCheckFMEA ( void  )

Definition at line 351 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateCheckFMEAGNDLAlert()

void testStateCheckFMEAGNDLAlert ( void  )

Definition at line 371 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateClearReceiveBuffer()

void testStateClearReceiveBuffer ( void  )

Definition at line 412 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateClearReceiveBufferFailedSPIWrite()

void testStateClearReceiveBufferFailedSPIWrite ( void  )

Definition at line 428 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateClearTransmitBuffer()

void testStateClearTransmitBuffer ( void  )

Definition at line 445 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateClearTransmitBufferFailedSPIWrite()

void testStateClearTransmitBufferFailedSPIWrite ( void  )

Definition at line 461 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateGetVersion()

void testStateGetVersion ( void  )

Definition at line 392 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateRequestConsistentInput()

void testStateRequestConsistentInput ( void  )

Definition at line 161 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateRequestInconsistentInputPayload()

void testStateRequestInconsistentInputPayload ( void  )

Definition at line 167 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateRequestInconsistentInputProcessed()

void testStateRequestInconsistentInputProcessed ( void  )

Definition at line 195 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateRequestInconsistentInputRXBuffer()

void testStateRequestInconsistentInputRXBuffer ( void  )

Definition at line 181 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateStayInIdle()

void testStateStayInIdle ( void  )

Definition at line 342 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateStayInUninitialized()

void testStateStayInUninitialized ( void  )

Definition at line 336 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateUARTWaitForRXStatusChangeFail()

void testStateUARTWaitForRXStatusChangeFail ( void  )

Definition at line 478 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testStateUARTWaitForRXStatusChangeSuccess()

void testStateUARTWaitForRXStatusChangeSuccess ( void  )

Definition at line 491 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testTransitionsOnlyAllowedInIdleAfterInit()

void testTransitionsOnlyAllowedInIdleAfterInit ( void  )

Definition at line 145 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testWriteRegisterFunctionWithIllegalValues()

void testWriteRegisterFunctionWithIllegalValues ( void  )

Definition at line 204 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ testWriteRegisterFunctionWithLegalValues()

void testWriteRegisterFunctionWithLegalValues ( void  )

Definition at line 207 of file test_mxm_17841b.c.

Here is the call graph for this function:

Variable Documentation

◆ commandBuffer

uint16_t commandBuffer[10] = {0}

Definition at line 85 of file test_mxm_17841b.c.

◆ mxm_41b_state

MXM_41B_INSTANCE_s mxm_41b_state
static
Initial value:
= {
.aliveCounter = 0,
.extendMessageBytes = 0,
.waitCounter = 0,
.regRXIntEnable = 0x00u,
.regTXIntEnable = 0x00u,
.regRXStatus = 0x00u,
.regTXStatus = 0x00u,
.regConfig1 = 0x60u,
.regConfig2 = 0x10u,
.regConfig3 = 0x0Fu,
.hwModel = 0,
.hwMaskRevision = 0,
.spiRXBuffer = {0},
.spiTXBuffer = {0},
}
@ MXM_STATEMACH_41B_UNINITIALIZED
Definition: mxm_17841b.h:81
@ MXM_41B_ENTRY_SUBSTATE
Definition: mxm_17841b.h:98

Definition at line 66 of file test_mxm_17841b.c.

◆ rxBuffer

uint16_t rxBuffer[100] = {0}

Definition at line 86 of file test_mxm_17841b.c.

◆ status41b