diff --git a/include/functions.h b/include/functions.h
index d7003c9..f761487 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -1,4 +1,7 @@
#include "../libopeninv/include/params.h"
+#ifdef TEST_COMMON_H
+#include "../test/digio_mock.h"
+#endif
static bool IsEvseInput();
static void DisableAll();
@@ -13,3 +16,16 @@ static bool CheckUnplugged()
{
return IsEvseInput() && !Param::GetBool(Param::proximity);
}
+
+static void DisableAll()
+{
+ DigIo::hvena_out.Clear();
+ DigIo::acpres_out.Clear();
+ DigIo::evseact_out.Clear();
+ DigIo::ch1act_out.Clear();
+ DigIo::ch2act_out.Clear();
+ DigIo::ch2act_out.Clear();
+ DigIo::ch1ena_out.Clear();
+ DigIo::ch2ena_out.Clear();
+ DigIo::ch3ena_out.Clear();
+}
diff --git a/src/main.cpp b/src/main.cpp
index efc3fee..43ee6b9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -120,18 +120,6 @@ static void EvseRead()
}
}
-static void DisableAll()
-{
- DigIo::hvena_out.Clear();
- DigIo::acpres_out.Clear();
- DigIo::evseact_out.Clear();
- DigIo::ch1act_out.Clear();
- DigIo::ch2act_out.Clear();
- DigIo::ch2act_out.Clear();
- DigIo::ch1ena_out.Clear();
- DigIo::ch2ena_out.Clear();
- DigIo::ch3ena_out.Clear();
-}
static bool CheckStartCondition()
diff --git a/tesla.cbp b/tesla.cbp
new file mode 100644
index 0000000..b61f75d
--- /dev/null
+++ b/tesla.cbp
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/test.c b/test/test.c
index 7cb21a4..a69ebf9 100644
--- a/test/test.c
+++ b/test/test.c
@@ -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}
//...
diff --git a/test/test.out b/test/test.out
index 29e27f3..0cd2e3e 100755
Binary files a/test/test.out and b/test/test.out differ
diff --git a/test/test_common.h b/test/test_common.h
index 70ae60b..a95cb3d 100644
--- a/test/test_common.h
+++ b/test/test_common.h
@@ -1,5 +1,7 @@
#ifndef TEST_COMMON_H
#define TEST_COMMON_H
+#include "functions.h"
+#include "digio_mock.h"
#endif
diff --git a/test/test_io.h b/test/test_io.h
new file mode 100644
index 0000000..91781c1
--- /dev/null
+++ b/test/test_io.h
@@ -0,0 +1,43 @@
+#ifndef TEST_IO_H
+#define TEST_IO_H
+#endif
+#include
+#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());
+
+}
diff --git a/test/test_state.h b/test/test_state.h
index 2ca8f1d..16d7f51 100644
--- a/test/test_state.h
+++ b/test/test_state.h
@@ -3,7 +3,6 @@
#endif
#include
#include "test_common.h"
-#include "functions.h"
void test_is_evse_input()
{