adding repetitive DigIo mock test

This commit is contained in:
Janosch
2022-10-10 16:46:25 +01:00
parent 624b33ee73
commit a6f275b742
8 changed files with 170 additions and 13 deletions
+2
View File
@@ -3,6 +3,7 @@
#include "../libopeninv/include/params.h"
#include "test.h"
#include "test_can.h"
#include "test_io.h"
#include "test_state.h"
extern void Param::Change(Param::PARAM_NUM ParamNum){ };
@@ -16,6 +17,7 @@ int main() {
TestCase tests[] = {
(TestCase){"test_is_evse_input", test_is_evse_input},
(TestCase){"test_check_unplugged", test_check_unplugged},
(TestCase){"test_disable_all", test_disable_all},
// Example:
//(TestCase){"Your tests name", function_name_without_brackets}
//...
BIN
View File
Binary file not shown.
+2
View File
@@ -1,5 +1,7 @@
#ifndef TEST_COMMON_H
#define TEST_COMMON_H
#include "functions.h"
#include "digio_mock.h"
#endif
+43
View File
@@ -0,0 +1,43 @@
#ifndef TEST_IO_H
#define TEST_IO_H
#endif
#include <assert.h>
#include "test_common.h"
void test_disable_all()
{
DigIo::hvena_out.Set();
DigIo::acpres_out.Set();
DigIo::evseact_out.Set();
DigIo::ch1act_out.Set();
DigIo::ch2act_out.Set();
DigIo::ch2act_out.Set();
DigIo::ch1ena_out.Set();
DigIo::ch2ena_out.Set();
DigIo::ch3ena_out.Set();
assert(DigIo::hvena_out.Get());
assert(DigIo::hvena_out.Get());
assert(DigIo::acpres_out.Get());
assert(DigIo::evseact_out.Get());
assert(DigIo::ch1act_out.Get());
assert(DigIo::ch2act_out.Get());
assert(DigIo::ch2act_out.Get());
assert(DigIo::ch1ena_out.Get());
assert(DigIo::ch2ena_out.Get());
assert(DigIo::ch3ena_out.Get());
DisableAll();
assert(!DigIo::hvena_out.Get());
assert(!DigIo::hvena_out.Get());
assert(!DigIo::acpres_out.Get());
assert(!DigIo::evseact_out.Get());
assert(!DigIo::ch1act_out.Get());
assert(!DigIo::ch2act_out.Get());
assert(!DigIo::ch2act_out.Get());
assert(!DigIo::ch1ena_out.Get());
assert(!DigIo::ch2ena_out.Get());
assert(!DigIo::ch3ena_out.Get());
}
-1
View File
@@ -3,7 +3,6 @@
#endif
#include <assert.h>
#include "test_common.h"
#include "functions.h"
void test_is_evse_input()
{