STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_board_net.cpp File Reference
#include <unity.h>
#include "board_net.h"
Include dependency graph for test_board_net.cpp:

Go to the source code of this file.

Macros

#define SENSOR_ETH_USE_DHCP
 Board networking unit tests.

Functions

static BoardNet::State makeState ()
static BoardNet::State recoveringState ()
void test_dhcp_lease_is_adopted (void)
void test_board_id_is_the_assigned_address (void)
void test_recovery_address_formula (void)
void test_no_answer_puts_the_board_on_its_recovery_address (void)
void test_source_is_reported_honestly (void)
void test_retry_waits_for_the_interval (void)
void test_failed_retry_stays_reflashable (void)
void test_retry_that_gets_a_lease_moves_the_board (void)
void test_no_retry_during_an_ota (void)
void test_lease_is_renewed_only_on_a_lease (void)
void test_ota_suspends_renewal (void)
void test_server_is_learned_from_its_packets (void)
void test_repeat_server_packet_is_not_a_change (void)
void test_learning_a_server_never_moves_our_address (void)
void test_server_silence_only_after_it_was_learned (void)
void test_server_silence_trips_after_timeout (void)
void test_mac_is_stored_for_reporting (void)
void setUp (void)
void tearDown (void)
int main (int, char **)

Variables

static const byte kMac [6] = {0xDE, 0xAD, 0xBE, 0xEF, 0x2A, 0x3C}
static const IPAddress kGateway (0, 0, 0, 0)
static const IPAddress kDns (192, 168, 2, 1)
static const IPAddress kDefaultServer (192, 168, 2, 20)
static const IPAddress kLeasedIP (192, 168, 2, 137)
static const IPAddress kRecoveryIP (169, 254, 43, 60)

Macro Definition Documentation

◆ SENSOR_ETH_USE_DHCP

#define SENSOR_ETH_USE_DHCP

Board networking unit tests.

Includes the REAL header (common/board_net.h) rather than a replica: the point of this suite is that the board's working address and ID come only from the server, and a replica could not prove that about the shipped code. The stubbed EthernetClass records what gets written to the chip.

Definition at line 11 of file test_board_net.cpp.

Function Documentation

◆ main()

◆ makeState()

◆ recoveringState()

◆ setUp()

void setUp ( void )

Definition at line 274 of file test_board_net.cpp.

◆ tearDown()

void tearDown ( void )

Definition at line 276 of file test_board_net.cpp.

◆ test_board_id_is_the_assigned_address()

void test_board_id_is_the_assigned_address ( void )

Definition at line 58 of file test_board_net.cpp.

References BoardNet::begin(), BoardNet::boardId(), Ethernet, IPAddress, kDns, kGateway, and makeState().

Referenced by main().

◆ test_dhcp_lease_is_adopted()

void test_dhcp_lease_is_adopted ( void )

◆ test_failed_retry_stays_reflashable()

void test_failed_retry_stays_reflashable ( void )

◆ test_learning_a_server_never_moves_our_address()

void test_learning_a_server_never_moves_our_address ( void )

◆ test_lease_is_renewed_only_on_a_lease()

void test_lease_is_renewed_only_on_a_lease ( void )

◆ test_mac_is_stored_for_reporting()

void test_mac_is_stored_for_reporting ( void )

Definition at line 265 of file test_board_net.cpp.

References BoardNet::State::mac, makeState(), and BoardNet::printMac().

Referenced by main().

◆ test_no_answer_puts_the_board_on_its_recovery_address()

void test_no_answer_puts_the_board_on_its_recovery_address ( void )

◆ test_no_retry_during_an_ota()

void test_no_retry_during_an_ota ( void )

◆ test_ota_suspends_renewal()

void test_ota_suspends_renewal ( void )

◆ test_recovery_address_formula()

void test_recovery_address_formula ( void )

Definition at line 69 of file test_board_net.cpp.

References IPAddress, and BoardNet::recoveryAddress().

Referenced by main().

◆ test_repeat_server_packet_is_not_a_change()

void test_repeat_server_packet_is_not_a_change ( void )

Definition at line 221 of file test_board_net.cpp.

References kDefaultServer, makeState(), and BoardNet::onServerPacket().

Referenced by main().

◆ test_retry_that_gets_a_lease_moves_the_board()

void test_retry_that_gets_a_lease_moves_the_board ( void )

◆ test_retry_waits_for_the_interval()

void test_retry_waits_for_the_interval ( void )

◆ test_server_is_learned_from_its_packets()

void test_server_is_learned_from_its_packets ( void )

◆ test_server_silence_only_after_it_was_learned()

void test_server_silence_only_after_it_was_learned ( void )

◆ test_server_silence_trips_after_timeout()

void test_server_silence_trips_after_timeout ( void )

◆ test_source_is_reported_honestly()

void test_source_is_reported_honestly ( void )

Variable Documentation

◆ kDefaultServer

◆ kDns

◆ kGateway

◆ kLeasedIP

◆ kMac

const byte kMac[6] = {0xDE, 0xAD, 0xBE, 0xEF, 0x2A, 0x3C}
static

Definition at line 17 of file test_board_net.cpp.

Referenced by makeState().

◆ kRecoveryIP

const IPAddress kRecoveryIP(169, 254, 43, 60) ( 169 ,
254 ,
43 ,
60  )
static