|
| static void | checkAgainstReference (const float(&cal)[3]) |
| | Every average power from -FULL_SCALE to +FULL_SCALE, in uneven steps.
|
| |
| template<uint8_t SUPPLY_FREQUENCY> |
| void | checkHundredthsOfJoule () |
| |
| static double | exactReference (int32_t sumP, uint8_t n, float cal) |
| | The exact energy of one cycle: no truncating division, in bucket units.
|
| |
| static int32_t | generalRounding (int32_t power, uint16_t calFixed, uint8_t shift) |
| | contribution() with the general rounding, (product + 2^(r-1)) >> r, in 64 bits.
|
| |
| int | main (int, char **) |
| |
| static double | quantisationError (float cal, uint8_t shift) |
| | Relative error of a quantised calibration value.
|
| |
| static double | reference (int32_t averagePower, float cal) |
| | The float arithmetic being replaced, in bucket units.
|
| |
| void | setUp (void) |
| |
| void | tearDown (void) |
| |
| void | test_bucket_capacity_fits_in_32_bits (void) |
| |
| void | test_contribution_at_full_scale_does_not_overflow (void) |
| |
| void | test_contribution_is_sign_symmetric (void) |
| |
| void | test_contribution_matches_the_reference_for_a_typical_calibration (void) |
| |
| void | test_contribution_matches_the_reference_for_extreme_calibrations (void) |
| |
| void | test_contribution_of_zero_is_zero (void) |
| |
| void | test_contribution_rounding_shortcut_is_exact (void) |
| |
| void | test_fromWatts_scales_by_the_fraction_bits (void) |
| |
| void | test_hundredths_of_joule_at_50Hz (void) |
| |
| void | test_hundredths_of_joule_at_60Hz (void) |
| |
| void | test_largest_value_fills_16_bits (void) |
| |
| void | test_no_drift_over_one_minute (void) |
| |
| void | test_per_sample_agrees_with_the_division_path (void) |
| |
| void | test_per_sample_contribution_matches_the_exact_reference (void) |
| |
| void | test_per_sample_fallback_for_an_unexpected_cycle_length (void) |
| |
| void | test_per_sample_full_scale_does_not_overflow (void) |
| |
| void | test_per_sample_largest_value_fills_16_bits (void) |
| |
| void | test_per_sample_no_drift_over_one_minute (void) |
| |
| void | test_per_sample_shift_and_values (void) |
| |
| void | test_per_sample_shift_for_60Hz (void) |
| |
| void | test_quantisation_error_is_negligible (void) |
| |
| void | test_shift_follows_the_largest_value (void) |
| |
| void | test_shift_for_a_typical_calibration (void) |
| |
| void | test_shift_for_large_and_small_values (void) |
| |
| void | test_toFixed_rounds_to_nearest (void) |
| |
| void | test_typical_set_quantisation_error (void) |
| |
| void | test_valid_calibration_accepts_realistic_values (void) |
| |
| void | test_valid_calibration_rejects_zero_negative_and_huge_values (void) |
| |
Native unit tests for energy_bucket.h.
The integer energy bucket must reproduce the float arithmetic it replaces, bucket += (l_sumP / n) * f_powerCal[phase] over the full input range, without overflow and without drifting over time. The float/double expression is the reference. No config.h, no stubs.
Definition in file test_main.cpp.