mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 09:49:32 +02:00
Add working unit tests
This commit is contained in:
parent
f609d54a14
commit
995cc7784c
106 changed files with 589 additions and 582 deletions
24
test/safety_tests.cpp
Normal file
24
test/safety_tests.cpp
Normal file
|
@ -0,0 +1,24 @@
|
|||
#include <gtest/gtest.h>
|
||||
|
||||
#include "../Software/src/datalayer/datalayer.h"
|
||||
#include "../Software/src/devboard/safety/safety.h"
|
||||
#include "../Software/src/devboard/utils/events.h"
|
||||
#include "../Software/src/inverter/ModbusInverterProtocol.h"
|
||||
|
||||
TEST(SafetyTests, ShouldSetEventWhenTemperatureTooHigh) {
|
||||
init_events();
|
||||
datalayer.system.info.CPU_temperature = 82;
|
||||
update_machineryprotection();
|
||||
|
||||
auto event_pointer = get_event_pointer(EVENT_CPU_OVERHEATING);
|
||||
EXPECT_EQ(event_pointer->occurences, 1);
|
||||
}
|
||||
|
||||
TEST(SafetyTests, ShouldSetEventWhenTemperatureWayTooHigh) {
|
||||
init_events();
|
||||
datalayer.system.info.CPU_temperature = 200;
|
||||
update_machineryprotection();
|
||||
|
||||
auto event_pointer = get_event_pointer(EVENT_CPU_OVERHEATED);
|
||||
EXPECT_EQ(event_pointer->occurences, 1);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue