foxBMS - Unit Tests  1.4.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 "Mockos.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.

Macros

#define MXM_41B_CONFIG_REGISTER_LENGTH   (7u)
 

Functions

void setUp (void)
 
void tearDown (void)
 
void testSetStateRequestInvalidInstancePointer (void)
 Test with an invalid pointer. More...
 
void testOnlyAllowedTransitionFromUnitializedIsInit (void)
 Test that the only transition from uninitialized is initialization. More...
 
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)
 
void testStateDefault (void)
 
void testStateInitNormalFlow (void)
 

Variables

static MXM_41B_INSTANCE_s mxm_41bState
 
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
2022-07-28 (date of last update)
Version
v1.4.0
Prefix
MXM

def

Definition in file test_mxm_17841b.c.

Macro Definition Documentation

◆ MXM_41B_CONFIG_REGISTER_LENGTH

#define MXM_41B_CONFIG_REGISTER_LENGTH   (7u)

replicating the config register length in the driver

Definition at line 69 of file test_mxm_17841b.c.

Function Documentation

◆ setUp()

void setUp ( void  )

Definition at line 95 of file test_mxm_17841b.c.

Here is the call graph for this function:

◆ tearDown()

void tearDown ( void  )

Definition at line 113 of file test_mxm_17841b.c.

Variable Documentation

◆ commandBuffer

uint16_t commandBuffer[10] = {0}

Definition at line 89 of file test_mxm_17841b.c.

◆ mxm_41bState

MXM_41B_INSTANCE_s mxm_41bState
static
Initial value:
= {
.extendMessageBytes = 0,
.waitCounter = 0,
.regRXIntEnable = 0x00u,
.regTXIntEnable = 0x00u,
.regRXStatus = 0x00u,
.regTXStatus = 0x00u,
.hwModel = 0,
.hwMaskRevision = 0,
.spiRXBuffer = {0},
.spiTXBuffer = {0},
}
@ MXM_STATEMACH_41B_UNINITIALIZED
Definition: mxm_17841b.h:85
@ MXM_41B_ENTRY_SUBSTATE
Definition: mxm_17841b.h:102
#define MXM_41B_CONFIG_3_DEFAULT_VALUE
Definition: mxm_cfg.h:104
#define MXM_41B_CONFIG_1_DEFAULT_VALUE
Definition: mxm_cfg.h:92
#define MXM_41B_CONFIG_2_DEFAULT_VALUE
Definition: mxm_cfg.h:98

Definition at line 71 of file test_mxm_17841b.c.

◆ rxBuffer

uint16_t rxBuffer[100] = {0}

Definition at line 90 of file test_mxm_17841b.c.

◆ status41b