foxBMS - Unit Tests
1.3.0
The foxBMS Unit Tests API Documentation
|
Tests for the bms driver implementation. More...
#include "unity.h"
#include "Mockafe.h"
#include "Mockbal.h"
#include "Mockbattery_system_cfg.h"
#include "Mockcontactor.h"
#include "Mockdatabase.h"
#include "Mockdiag.h"
#include "Mockfassert.h"
#include "Mockimd.h"
#include "Mockinterlock.h"
#include "Mockled.h"
#include "Mockmeas.h"
#include "Mockos.h"
#include "Mockplausibility.h"
#include "Mocksoa.h"
#include "bms.h"
#include "foxmath.h"
#include "test_assert_helper.h"
Go to the source code of this file.
Macros | |
#define | NUM_PRECHARGE_TESTS 13 |
Functions | |
void | setUp (void) |
void | tearDown (void) |
STD_RETURN_TYPE_e | MockDATA_ReadBlock_Callback (void *pDataToReceiver, int num_calls) |
void | testCheckPrechargeIterateStub (void) |
Iterate over a callback that supplies various scenarios and check if they work as expected. More... | |
void | testBMS_GetCurrentFlowDirectionWithTypicalValues (void) |
void | testCheckCurrentValueDirectionWithCurrentZeroMaxAndMin (void) |
void | testBMS_CheckPrechargeInvalidStringNumber (void) |
Tests for the bms driver implementation.
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:
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:
Definition in file test_bms.c.
#define NUM_PRECHARGE_TESTS 13 |
Definition at line 96 of file test_bms.c.
STD_RETURN_TYPE_e MockDATA_ReadBlock_Callback | ( | void * | pDataToReceiver, |
int | num_calls | ||
) |
Definition at line 101 of file test_bms.c.
void setUp | ( | void | ) |
Definition at line 89 of file test_bms.c.
void tearDown | ( | void | ) |
Definition at line 92 of file test_bms.c.
void testBMS_CheckPrechargeInvalidStringNumber | ( | void | ) |
check that invalid values to BMS_CheckPrecharge trip an assertion
invalid values are all those that do not fall into 0 <= stringNumber < BS_NR_OF_STRINGS
Definition at line 314 of file test_bms.c.
void testBMS_GetCurrentFlowDirectionWithTypicalValues | ( | void | ) |
void testCheckCurrentValueDirectionWithCurrentZeroMaxAndMin | ( | void | ) |
void testCheckPrechargeIterateStub | ( | void | ) |
Iterate over a callback that supplies various scenarios and check if they work as expected.
This function uses the callback MockDATA_ReadBlock_Callback() in order to inject current tables and voltage tables into the returned database tables. The array prechargeExpectedResults contains prepared return values against which the output of TEST_BMS_CheckPrecharge() is compared.
Definition at line 230 of file test_bms.c.
BS_STRING_PRECHARGE_PRESENT_e bs_stringsWithPrecharge[BS_NR_OF_STRINGS] |
Precharge presence of not for each string
Definition at line 84 of file test_bms.c.
DIAG_DEV_s diag_device |
diag device configuration struct
Definition at line 78 of file test_bms.c.
DIAG_ID_CFG_s DIAG_ID_cfg[] = {} |
variable tracking the state of the diag channels
Definition at line 76 of file test_bms.c.
STD_RETURN_TYPE_e prechargeExpectedResults[BS_NR_OF_STRINGS][NUM_PRECHARGE_TESTS] = {0} |
Definition at line 97 of file test_bms.c.