3-phase PV router
Loading...
Searching...
No Matches
test_main.cpp File Reference
#include <Arduino.h>
#include <unity.h>
#include "../halt_after_tests.h"
#include "types.h"
#include "utils_pins.h"
#include "utils_relay.h"
Include dependency graph for test_main.cpp:

Go to the source code of this file.

Functions

void feed_import_to_ordering_relays (void)
 
void feed_surplus_to_ordering_relays (void)
 
void loop ()
 
void setUp (void)
 
void setup ()
 
void tearDown (void)
 
void test_diversion_disabled (void)
 
void test_diversion_disabled_forces_relays_off (void)
 
void test_diversion_disabled_keeps_forced_relay_on (void)
 
void test_diversion_disabled_respects_minON (void)
 
void test_diversion_disabled_sets_settle_change (void)
 
void test_duration_overflow (void)
 
void test_duration_overflow_saturates_at_uint16_max (void)
 
void test_duration_overflow_stays_at_max_after_more_increments (void)
 
void test_duration_overflow_wrap_would_block_relay (void)
 
void test_forced_only (void)
 
void test_forced_only_respects_minON_time (void)
 
void test_forced_only_succeeds_after_minON (void)
 
void test_forced_only_turns_on_when_forced (void)
 
void test_forced_only_when_already_off (void)
 
void test_get_importThreshold (void)
 
void test_get_minOFF (void)
 
void test_get_minON (void)
 
void test_get_pin (void)
 
void test_get_size (void)
 
void test_get_surplusThreshold (void)
 
void test_isRelayON (void)
 
void test_proceed_relay (void)
 
void test_proceed_settle_change (void)
 
void test_relay_initialization (void)
 
void test_relay_initialization_with_negative_thresholds (void)
 
void test_relay_initialization_with_positive_thresholds (void)
 
void test_relay_ordering (void)
 
void test_relay_ordering_import_turns_off_descending (void)
 
void test_relay_ordering_surplus_turns_on_ascending (void)
 
void test_relay_override_minimum_ON_time (void)
 
void test_relay_override_turnON (void)
 
void test_relay_turnOFF (void)
 
void test_relay_turnON (void)
 
void test_settle_change_allows_changes_after_60_seconds (void)
 
void test_settle_change_blocks_initial_relay_changes (void)
 
void test_settle_change_blocks_turn_off_as_well (void)
 
void test_settle_change_resets_after_relay_change (void)
 
void wait_for_relay_change_allowed (void)
 

Variables

constexpr RelayDiverter< 2, 5 > diversionTestRelays
 
constexpr RelayDiverter< 1, 4 > forceOffTestRelays
 
constexpr RelayDiverter< 3, 3 > orderingTestRelays
 
constexpr RelayDiverter< 1, 2 > overflowTestRelays
 
constexpr RelayDiverter< 2, 1 > settleTestRelays
 
constexpr RelayDiverter testRelays
 

Function Documentation

◆ feed_import_to_ordering_relays()

void feed_import_to_ordering_relays ( void )

Definition at line 408 of file test_main.cpp.

Here is the caller graph for this function:

◆ feed_surplus_to_ordering_relays()

void feed_surplus_to_ordering_relays ( void )

Definition at line 399 of file test_main.cpp.

Here is the caller graph for this function:

◆ loop()

void loop ( )

Definition at line 957 of file test_main.cpp.

Here is the call graph for this function:

◆ setUp()

void setUp ( void )

Definition at line 15 of file test_main.cpp.

◆ setup()

void setup ( )

Definition at line 950 of file test_main.cpp.

◆ tearDown()

void tearDown ( void )

Definition at line 20 of file test_main.cpp.

◆ test_diversion_disabled()

void test_diversion_disabled ( void )

Definition at line 939 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_diversion_disabled_forces_relays_off()

void test_diversion_disabled_forces_relays_off ( void )

Definition at line 767 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_diversion_disabled_keeps_forced_relay_on()

void test_diversion_disabled_keeps_forced_relay_on ( void )

Definition at line 917 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_diversion_disabled_respects_minON()

void test_diversion_disabled_respects_minON ( void )

Definition at line 822 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_diversion_disabled_sets_settle_change()

void test_diversion_disabled_sets_settle_change ( void )

Definition at line 875 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_duration_overflow()

void test_duration_overflow ( void )

Definition at line 650 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_duration_overflow_saturates_at_uint16_max()

void test_duration_overflow_saturates_at_uint16_max ( void )

Definition at line 540 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_duration_overflow_stays_at_max_after_more_increments()

void test_duration_overflow_stays_at_max_after_more_increments ( void )

Definition at line 568 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_duration_overflow_wrap_would_block_relay()

void test_duration_overflow_wrap_would_block_relay ( void )

Definition at line 595 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_forced_only()

void test_forced_only ( void )

Definition at line 747 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_forced_only_respects_minON_time()

void test_forced_only_respects_minON_time ( void )

Definition at line 677 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_forced_only_succeeds_after_minON()

void test_forced_only_succeeds_after_minON ( void )

Definition at line 709 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_forced_only_turns_on_when_forced()

void test_forced_only_turns_on_when_forced ( void )

Definition at line 727 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_forced_only_when_already_off()

void test_forced_only_when_already_off ( void )

Definition at line 667 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_importThreshold()

void test_get_importThreshold ( void )

Definition at line 61 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_minOFF()

void test_get_minOFF ( void )

Definition at line 73 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_minON()

void test_get_minON ( void )

Definition at line 67 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_pin()

void test_get_pin ( void )

Definition at line 49 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_size()

void test_get_size ( void )

Definition at line 227 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_get_surplusThreshold()

void test_get_surplusThreshold ( void )

Definition at line 55 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_isRelayON()

void test_isRelayON ( void )

Definition at line 79 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_proceed_relay()

void test_proceed_relay ( void )

Definition at line 216 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_proceed_settle_change()

void test_proceed_settle_change ( void )

Definition at line 376 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_initialization()

void test_relay_initialization ( void )

Definition at line 25 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_initialization_with_negative_thresholds()

void test_relay_initialization_with_negative_thresholds ( void )

Definition at line 41 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_initialization_with_positive_thresholds()

void test_relay_initialization_with_positive_thresholds ( void )

Definition at line 33 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_ordering()

void test_relay_ordering ( void )

Definition at line 524 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_ordering_import_turns_off_descending()

void test_relay_ordering_import_turns_off_descending ( void )

Definition at line 475 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_ordering_surplus_turns_on_ascending()

void test_relay_ordering_surplus_turns_on_ascending ( void )

Definition at line 426 of file test_main.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_relay_override_minimum_ON_time()

void test_relay_override_minimum_ON_time ( void )

Definition at line 180 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_relay_override_turnON()

void test_relay_override_turnON ( void )

Definition at line 142 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_relay_turnOFF()

void test_relay_turnOFF ( void )

Definition at line 113 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_relay_turnON()

void test_relay_turnON ( void )

Definition at line 84 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_settle_change_allows_changes_after_60_seconds()

void test_settle_change_allows_changes_after_60_seconds ( void )

Definition at line 269 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_settle_change_blocks_initial_relay_changes()

void test_settle_change_blocks_initial_relay_changes ( void )

Definition at line 244 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_settle_change_blocks_turn_off_as_well()

void test_settle_change_blocks_turn_off_as_well ( void )

Definition at line 336 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_settle_change_resets_after_relay_change()

void test_settle_change_resets_after_relay_change ( void )

Definition at line 295 of file test_main.cpp.

Here is the caller graph for this function:

◆ wait_for_relay_change_allowed()

void wait_for_relay_change_allowed ( void )

Definition at line 417 of file test_main.cpp.

Here is the caller graph for this function:

Variable Documentation

◆ diversionTestRelays

RelayDiverter< 2, 5 > diversionTestRelays
constexpr
Initial value:
{ { 5, 500, 100, 1, 1 },
{ 6, 800, 150, 1, 1 } } }

Definition at line 763 of file test_main.cpp.

◆ forceOffTestRelays

RelayDiverter< 1, 4 > forceOffTestRelays
constexpr
Initial value:
{ { 4, 500, 100, 1, 1 } } }

Definition at line 664 of file test_main.cpp.

◆ orderingTestRelays

RelayDiverter< 3, 3 > orderingTestRelays
constexpr
Initial value:
{ { 11, 500, 100, 1, 1 },
{ 12, 500, 100, 1, 1 },
{ 13, 500, 100, 1, 1 } } }

Definition at line 394 of file test_main.cpp.

◆ overflowTestRelays

RelayDiverter< 1, 2 > overflowTestRelays
constexpr
Initial value:
{ { 10, 500, 100, 1, 1 } } }

Definition at line 537 of file test_main.cpp.

◆ settleTestRelays

RelayDiverter< 2, 1 > settleTestRelays
constexpr
Initial value:
{ { 8, 500, 100, 1, 1 },
{ 9, 800, 150, 1, 1 } } }

Definition at line 240 of file test_main.cpp.

◆ testRelays

RelayDiverter testRelays
constexpr
Initial value:
{ { { 2, 1000, 200, 1, 1 },
{ 3, 100, 20, 2, 3 } } }

Definition at line 12 of file test_main.cpp.