STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
test_main.cpp File Reference
#include <string.h>
#include "fake_chip.h"
#include "unity.h"
#include "../../../src/chips/sx1262.cpp"
Include dependency graph for test_main.cpp:

Go to the source code of this file.

Functions

void setUp (void)
void tearDown (void)
static void test_no_flags_returns_no_data (void)
static void test_packet_is_read_with_the_right_bytes_and_length (void)
static void test_the_four_exchanges_happen_in_order (void)
static void test_start_position_in_the_chip_buffer_is_used (void)
static void test_packet_flag_is_cleared_after_reading (void)
static void test_biggest_packet_255_bytes_is_read_whole (void)
static void test_packet_bigger_than_the_box_is_dropped (void)
static void test_radio_crc_error_drops_the_packet (void)
static void test_header_error_drops_the_packet (void)
static void test_zero_length_packet_is_dropped (void)
static void test_chip_stuck_busy_reports_not_found (void)
static void test_busy_is_checked_before_every_exchange (void)
static void test_missing_chip_reading_zeros_reports_not_found (void)
static void test_missing_chip_reading_ones_reports_not_found (void)
static void test_command_failure_status_reports_not_found (void)
static void test_bad_status_while_reading_a_packet_reports_not_found (void)
static void test_start_rx_continuous_sends_setrx_ffffff (void)
static void test_start_rx_continuous_fails_when_busy_never_clears (void)
static void test_damaged_packets_are_counted (void)
static void test_packet_status_sends_0x14_and_four_nops (void)
static void test_packet_status_converts_rssi_and_negative_snr (void)
static void test_packet_status_positive_snr (void)
static void test_packet_status_missing_chip_leaves_output_alone (void)
static void test_packet_status_busy_never_clears (void)
int main (void)

Variables

static FakeChip chip
static const uint8_t kFrame [7] = {0x01, 0x11, 0x05, 0x00, 0x00, 0xBE, 0x3D}

Function Documentation

◆ main()

◆ setUp()

void setUp ( void )

Definition at line 14 of file test_main.cpp.

References chip.

◆ tearDown()

void tearDown ( void )

Definition at line 17 of file test_main.cpp.

◆ test_bad_status_while_reading_a_packet_reports_not_found()

void test_bad_status_while_reading_a_packet_reports_not_found ( void )
static

Definition at line 193 of file test_main.cpp.

References chip, radio_link::ErrNotFound, kFrame, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_biggest_packet_255_bytes_is_read_whole()

void test_biggest_packet_255_bytes_is_read_whole ( void )
static

Definition at line 77 of file test_main.cpp.

References chip, radio_link::Ok, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_busy_is_checked_before_every_exchange()

void test_busy_is_checked_before_every_exchange ( void )
static

Definition at line 150 of file test_main.cpp.

References chip, kFrame, radio_link::Ok, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_chip_stuck_busy_reports_not_found()

void test_chip_stuck_busy_reports_not_found ( void )
static

Definition at line 138 of file test_main.cpp.

References chip, radio_link::ErrNotFound, kFrame, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_command_failure_status_reports_not_found()

void test_command_failure_status_reports_not_found ( void )
static

Definition at line 182 of file test_main.cpp.

References chip, radio_link::ErrNotFound, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_damaged_packets_are_counted()

void test_damaged_packets_are_counted ( void )
static

◆ test_header_error_drops_the_packet()

void test_header_error_drops_the_packet ( void )
static

Definition at line 118 of file test_main.cpp.

References chip, kFrame, radio_link::kIrqHeaderErr, radio_link::NoData, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_missing_chip_reading_ones_reports_not_found()

void test_missing_chip_reading_ones_reports_not_found ( void )
static

Definition at line 171 of file test_main.cpp.

References chip, radio_link::ErrNotFound, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_missing_chip_reading_zeros_reports_not_found()

void test_missing_chip_reading_zeros_reports_not_found ( void )
static

Definition at line 162 of file test_main.cpp.

References chip, radio_link::ErrNotFound, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_no_flags_returns_no_data()

void test_no_flags_returns_no_data ( void )
static

Definition at line 23 of file test_main.cpp.

References chip, radio_link::kOpGetIrqStatus, radio_link::NoData, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_packet_bigger_than_the_box_is_dropped()

void test_packet_bigger_than_the_box_is_dropped ( void )
static

◆ test_packet_flag_is_cleared_after_reading()

void test_packet_flag_is_cleared_after_reading ( void )
static

Definition at line 66 of file test_main.cpp.

References chip, kFrame, radio_link::NoData, radio_link::Ok, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_packet_is_read_with_the_right_bytes_and_length()

void test_packet_is_read_with_the_right_bytes_and_length ( void )
static

Definition at line 34 of file test_main.cpp.

References chip, kFrame, radio_link::Ok, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_packet_status_busy_never_clears()

void test_packet_status_busy_never_clears ( void )
static

Definition at line 283 of file test_main.cpp.

References chip, and radio_link::Sx1262::packet_status().

Referenced by main().

◆ test_packet_status_converts_rssi_and_negative_snr()

void test_packet_status_converts_rssi_and_negative_snr ( void )
static

◆ test_packet_status_missing_chip_leaves_output_alone()

void test_packet_status_missing_chip_leaves_output_alone ( void )
static

◆ test_packet_status_positive_snr()

void test_packet_status_positive_snr ( void )
static

◆ test_packet_status_sends_0x14_and_four_nops()

void test_packet_status_sends_0x14_and_four_nops ( void )
static

Definition at line 240 of file test_main.cpp.

References chip, radio_link::kOpGetPacketStatus, and radio_link::Sx1262::packet_status().

Referenced by main().

◆ test_radio_crc_error_drops_the_packet()

void test_radio_crc_error_drops_the_packet ( void )
static

Definition at line 107 of file test_main.cpp.

References chip, kFrame, radio_link::kIrqCrcErr, radio_link::NoData, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_start_position_in_the_chip_buffer_is_used()

void test_start_position_in_the_chip_buffer_is_used ( void )
static

Definition at line 57 of file test_main.cpp.

References chip, kFrame, radio_link::Ok, and radio_link::Sx1262::receive().

Referenced by main().

◆ test_start_rx_continuous_fails_when_busy_never_clears()

void test_start_rx_continuous_fails_when_busy_never_clears ( void )
static

Definition at line 216 of file test_main.cpp.

References chip, and radio_link::Sx1262::start_rx_continuous().

Referenced by main().

◆ test_start_rx_continuous_sends_setrx_ffffff()

void test_start_rx_continuous_sends_setrx_ffffff ( void )
static

Definition at line 205 of file test_main.cpp.

References chip, and radio_link::Sx1262::start_rx_continuous().

Referenced by main().

◆ test_the_four_exchanges_happen_in_order()

void test_the_four_exchanges_happen_in_order ( void )
static

◆ test_zero_length_packet_is_dropped()

void test_zero_length_packet_is_dropped ( void )
static

Definition at line 128 of file test_main.cpp.

References chip, radio_link::kIrqRxDone, radio_link::NoData, and radio_link::Sx1262::receive().

Referenced by main().

Variable Documentation

◆ chip

FakeChip chip
static

Definition at line 12 of file test_main.cpp.

Referenced by setUp(), test_bad_status_while_reading_a_packet_reports_not_found(), test_biggest_packet_255_bytes_is_read_whole(), test_busy_is_checked_before_every_exchange(), test_chip_stuck_busy_reports_not_found(), test_command_failure_status_reports_not_found(), test_configure_follows_the_datasheet_order(), test_configure_names_the_failing_step(), test_damaged_packets_are_counted(), test_duty_cycle_1ms_is_64_steps(), test_duty_cycle_sends_correct_opcode_and_periods(), test_header_error_drops_the_packet(), test_missing_chip_reading_ones_reports_not_found(), test_missing_chip_reading_zeros_reports_not_found(), test_no_flags_returns_no_data(), test_no_rearm_means_no_duty_cycle_command(), test_packet_bigger_than_the_box_is_dropped(), test_packet_flag_is_cleared_after_reading(), test_packet_is_read_with_the_right_bytes_and_length(), test_packet_status_busy_never_clears(), test_packet_status_converts_rssi_and_negative_snr(), test_packet_status_missing_chip_leaves_output_alone(), test_packet_status_positive_snr(), test_packet_status_sends_0x14_and_four_nops(), test_radio_crc_error_drops_the_packet(), test_radio_rearmed_after_every_rxdone(), test_rearm_is_noop_in_continuous_mode(), test_rearm_restarts_duty_cycle_after_rxdone(), test_send_keeps_a_packet_that_just_arrived(), test_send_refuses_bad_input_and_dead_chip(), test_send_returns_to_duty_cycle_not_continuous(), test_send_times_out(), test_send_waits_for_tx_done_and_returns_to_rx(), test_start_continuous_after_duty_cycle(), test_start_position_in_the_chip_buffer_is_used(), test_start_rx_continuous_fails_when_busy_never_clears(), test_start_rx_continuous_sends_setrx_ffffff(), test_the_four_exchanges_happen_in_order(), and test_zero_length_packet_is_dropped().

◆ kFrame