3-phase PV router
Loading...
Searching...
No Matches
test_main.cpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
10
11#include <unity.h>
12
13#include "config.h" // the settings, and config_types.h: nothing else
14#include "utils_dualtariff.h" // BoostSchedule
15#include "utils_override.h" // TargetMap, OverrideTable
16
17void setUp(void) {}
18void tearDown(void) {}
19
21{
22 TEST_ASSERT_EQUAL(NO_OF_DUMPLOADS, sizeof(physicalLoadPin));
23 TEST_ASSERT_EQUAL(NO_OF_DUMPLOADS, sizeof(loadPrioritiesAtStartup));
24 TEST_ASSERT_TRUE(relays.size() > 0);
25 TEST_ASSERT_TRUE(temperatureSensing.size() > 0);
26 TEST_ASSERT_TRUE(rotationGroups.size() <= NO_OF_DUMPLOADS / 2);
27}
28
30{
31 constexpr TargetMap targets{ physicalLoadPin, relays, RELAY_DIVERSION };
32 constexpr OverrideTable table{ overridePins, targets };
33 constexpr BoostSchedule boosts{ scheduledBoosts, targets };
34
35 TEST_ASSERT_EQUAL(overridePins.size(), table.size());
36 for (uint8_t i = 0; i != overridePins.size(); ++i)
37 {
38 TEST_ASSERT_EQUAL(overridePins.getPin(i), table.getPin(i));
39 // a target that resolves to nothing is reported by validation.h; here, the list just resolves
40 TEST_ASSERT_TRUE(overridePins.getTargets(i).count > 0);
41 }
42 TEST_ASSERT_EQUAL(scheduledBoosts.size(), boosts.size());
43}
44
45int main(int /* argc */, char** /* argv */)
46{
47 UNITY_BEGIN();
48
51
52 return UNITY_END();
53}
The scheduled boosts: a window and the bitmasks of its targets, for each entry.
Manages override pins and their associated bitmasks for forced operation.
What the target codes of config.h stand for, once the load map and the relays are known.
Router configuration: loads, relays, control pins and features.
constexpr uint8_t loadPrioritiesAtStartup[NO_OF_DUMPLOADS]
Definition config.h:91
constexpr ScheduledBoosts scheduledBoosts
Definition config.h:172
constexpr bool RELAY_DIVERSION
Definition config.h:63
constexpr TemperatureSensing temperatureSensing
Definition config.h:177
constexpr RelayEngine relays
Definition config.h:130
constexpr uint8_t physicalLoadPin[NO_OF_DUMPLOADS]
Definition config.h:50
constexpr OverridePins overridePins
Definition config.h:157
constexpr RotationGroups rotationGroups
Definition config.h:100
constexpr uint8_t NO_OF_DUMPLOADS
Definition config.h:40
void setUp(void)
Definition test_main.cpp:27
void tearDown(void)
Definition test_main.cpp:28
uint8_t i
void test_targets_resolve_as_in_config_derived_h(void)
Definition test_main.cpp:29
void test_config_h_reads_on_its_own(void)
Definition test_main.cpp:20
int main(void)
Some utility functions for dual tariff feature.
Compile-time utilities for managing override pins and index-to-bitmask mapping.