3-phase PV router
Loading...
Searching...
No Matches
test_main.cpp File Reference

Native unit tests for temp_schedule.h: which 1-Wire transaction runs on which mains cycle. More...

#include <unity.h>
#include <stdint.h>
#include "temp_schedule.h"
Include dependency graph for test_main.cpp:

Go to the source code of this file.

Classes

struct  Action
 The transaction to run, and the sensor it reads (ADDRESS, READ, CLOSE). More...
 

Enumerations

enum class  Step
 The 1-Wire transaction of a mains cycle. More...
 

Functions

int main (int argc, char **argv)
 
template<uint8_t N, uint8_t F>
static bool roundEndsInPeriod (const uint16_t periodCycles)
 A datalog period of the main loop: the round must be over before the cycle that ends the period, whose ISR copies run ~1248 µs before the new cycle is flagged.
 
void setUp (void)
 
void tearDown (void)
 
void test_a_sensor_that_does_not_answer_is_skipped ()
 
void test_conversion_cycles_cover_750_ms ()
 
void test_conversion_in_the_cycle_that_ends_the_period ()
 
void test_first_read_conversion_cycles_after_the_conversion ()
 
void test_late_cycles_postpone_without_losing_a_step ()
 
void test_late_cycles_still_count_for_the_conversion ()
 
void test_never_two_transactions_in_one_cycle_and_never_before_the_conversion_time ()
 
void test_new_period_continues_an_unfinished_round ()
 
void test_new_period_restarts_a_finished_round ()
 
void test_round_of_two_sensors ()
 
void test_rounds_fit_their_period ()
 

Detailed Description

Native unit tests for temp_schedule.h: which 1-Wire transaction runs on which mains cycle.

The main loop asks the schedule once per mains cycle, when it sees the new cycle, and runs the transaction it gets: the conversion of every sensor, then, once the conversion time has passed, the three transactions of each sensor's read. One transaction per cycle at most, only on a cycle seen on time (the loop idle when it began), and the round over well before the end of the datalog period, whose values it gives.

Definition in file test_main.cpp.

Enumeration Type Documentation

◆ Step

enum class TempSchedule::Step : uint8_t
strong

The 1-Wire transaction of a mains cycle.

Definition at line 56 of file temp_schedule.h.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 286 of file test_main.cpp.

Here is the call graph for this function:

◆ roundEndsInPeriod()

template<uint8_t N, uint8_t F>
static bool roundEndsInPeriod ( const uint16_t periodCycles)
static

A datalog period of the main loop: the round must be over before the cycle that ends the period, whose ISR copies run ~1248 µs before the new cycle is flagged.

The cycle after each per-second tick is late (the per-second work and the display may run past the next tick).

Definition at line 246 of file test_main.cpp.

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

◆ setUp()

void setUp ( void )

Definition at line 22 of file test_main.cpp.

◆ tearDown()

void tearDown ( void )

Definition at line 23 of file test_main.cpp.

◆ test_a_sensor_that_does_not_answer_is_skipped()

void test_a_sensor_that_does_not_answer_is_skipped ( )

Definition at line 135 of file test_main.cpp.

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

◆ test_conversion_cycles_cover_750_ms()

void test_conversion_cycles_cover_750_ms ( )

Definition at line 51 of file test_main.cpp.

Here is the caller graph for this function:

◆ test_conversion_in_the_cycle_that_ends_the_period()

void test_conversion_in_the_cycle_that_ends_the_period ( )

Definition at line 168 of file test_main.cpp.

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

◆ test_first_read_conversion_cycles_after_the_conversion()

void test_first_read_conversion_cycles_after_the_conversion ( )

Definition at line 85 of file test_main.cpp.

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

◆ test_late_cycles_postpone_without_losing_a_step()

void test_late_cycles_postpone_without_losing_a_step ( )

Definition at line 105 of file test_main.cpp.

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

◆ test_late_cycles_still_count_for_the_conversion()

void test_late_cycles_still_count_for_the_conversion ( )

Definition at line 123 of file test_main.cpp.

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

◆ test_never_two_transactions_in_one_cycle_and_never_before_the_conversion_time()

void test_never_two_transactions_in_one_cycle_and_never_before_the_conversion_time ( )

Definition at line 201 of file test_main.cpp.

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

◆ test_new_period_continues_an_unfinished_round()

void test_new_period_continues_an_unfinished_round ( )

Definition at line 188 of file test_main.cpp.

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

◆ test_new_period_restarts_a_finished_round()

void test_new_period_restarts_a_finished_round ( )

Definition at line 155 of file test_main.cpp.

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

◆ test_round_of_two_sensors()

void test_round_of_two_sensors ( )

Definition at line 65 of file test_main.cpp.

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

◆ test_rounds_fit_their_period()

void test_rounds_fit_their_period ( )

Definition at line 263 of file test_main.cpp.

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