foxBMS-UnitTests  1.0.0
The foxBMS Unit Tests API Documentation
test_can.c File Reference

Tests for the CAN driver. More...

#include "unity.h"
#include "MockHL_can.h"
#include "Mockcan_cfg.h"
#include "Mockdatabase.h"
#include "Mockdiag.h"
#include "Mockfoxmath.h"
#include "Mockio.h"
#include "Mockmcu.h"
#include "Mockos.h"
#include "can.h"
#include "test_assert_helper.h"
Include dependency graph for test_can.c:

Go to the source code of this file.

Functions

static uint32_t can_dummy (uint32_t id, uint8_t dlc, CAN_byteOrder_e byteOrder, uint8_t *canData)
 
void setUp (void)
 
void tearDown (void)
 
void testDataSendNullPointerAsNode (void)
 
void testDataSendNullPointerAsData (void)
 
void testDataSendNoMessagePending (void)
 
void testDataSendMessagePending (void)
 
void testEnablePeriodic (void)
 
void testIsCurrentSensorPresent (void)
 
void testIsCurrentSensorCcPresent (void)
 

Variables

const CAN_MSG_TX_TYPE_s can_txMessages []
 
const CAN_MSG_RX_TYPE_s can_rxMessages []
 
const uint8_t can_txLength = sizeof(can_txMessages) / sizeof(can_txMessages[0])
 
const uint8_t can_rxLength = sizeof(can_rxMessages) / sizeof(can_rxMessages[0])
 
CAN_STATE_scanTestState = NULL_PTR
 

Detailed Description

Tests for the CAN driver.

BSD 3-Clause License 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-04-01 (date of creation)
Updated
2020-04-01 (date of last update)
Prefix
TEST

Definition in file test_can.c.

Function Documentation

◆ can_dummy()

static uint32_t can_dummy ( uint32_t  id,
uint8_t  dlc,
CAN_byteOrder_e  byteOrder,
uint8_t *  canData 
)
static

Definition at line 71 of file test_can.c.

◆ setUp()

void setUp ( void  )

Definition at line 89 of file test_can.c.

Here is the call graph for this function:

◆ tearDown()

void tearDown ( void  )

Definition at line 100 of file test_can.c.

◆ testDataSendMessagePending()

void testDataSendMessagePending ( void  )

Definition at line 131 of file test_can.c.

Here is the call graph for this function:

◆ testDataSendNoMessagePending()

void testDataSendNoMessagePending ( void  )

Definition at line 120 of file test_can.c.

Here is the call graph for this function:

◆ testDataSendNullPointerAsData()

void testDataSendNullPointerAsData ( void  )

Definition at line 112 of file test_can.c.

Here is the call graph for this function:

◆ testDataSendNullPointerAsNode()

void testDataSendNullPointerAsNode ( void  )

Definition at line 104 of file test_can.c.

Here is the call graph for this function:

◆ testEnablePeriodic()

void testEnablePeriodic ( void  )

Definition at line 152 of file test_can.c.

Here is the call graph for this function:

◆ testIsCurrentSensorCcPresent()

void testIsCurrentSensorCcPresent ( void  )

Definition at line 178 of file test_can.c.

Here is the call graph for this function:

◆ testIsCurrentSensorPresent()

void testIsCurrentSensorPresent ( void  )

Definition at line 163 of file test_can.c.

Here is the call graph for this function:

Variable Documentation

◆ can_rxLength

const uint8_t can_rxLength = sizeof(can_rxMessages) / sizeof(can_rxMessages[0])

Definition at line 84 of file test_can.c.

◆ can_rxMessages

const CAN_MSG_RX_TYPE_s can_rxMessages[]
Initial value:
= {
{0x002, 8, 0, littleEndian, &can_dummy},
}

registry of CAN RX messages

Definition at line 79 of file test_can.c.

◆ can_txLength

const uint8_t can_txLength = sizeof(can_txMessages) / sizeof(can_txMessages[0])

array length for transmission CAN0 message definition

length of CAN message arrays

Definition at line 83 of file test_can.c.

◆ can_txMessages

const CAN_MSG_TX_TYPE_s can_txMessages[]
Initial value:
= {
{0x001, 8, 100, 0, littleEndian, &can_dummy},
}

registry of CAN TX messages

Definition at line 75 of file test_can.c.

◆ canTestState

CAN_STATE_s* canTestState = NULL_PTR

Definition at line 86 of file test_can.c.

littleEndian
@ littleEndian
Definition: can_cfg.h:99
can_dummy
static uint32_t can_dummy(uint32_t id, uint8_t dlc, CAN_byteOrder_e byteOrder, uint8_t *canData)
Definition: test_can.c:71