summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-05-12 10:30:07 +1000
committerjacqueline <me@jacqueline.id.au>2023-05-12 10:30:07 +1000
commit961c8014ada037712e8c72f23430362e9f14c1ec (patch)
treece13e0a00fc0d0318d46e6dfbecf2360b4cc5e14 /test
parent10eb120878e01579bff2fdfab7bef59639b21155 (diff)
downloadtangara-fw-961c8014ada037712e8c72f23430362e9f14c1ec.tar.gz
Add some basic tests for the database
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/fixtures/CMakeLists.txt1
-rw-r--r--test/fixtures/i2c_fixture.hpp10
-rw-r--r--test/fixtures/spi_fixture.hpp10
-rw-r--r--test/sdkconfig.test2
5 files changed, 23 insertions, 1 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 74a83fe1..fdd2735f 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -19,6 +19,7 @@ list(APPEND EXTRA_COMPONENT_DIRS
"$ENV{PROJ_PATH}/src/tasks"
"$ENV{PROJ_PATH}/src/ui"
"$ENV{PROJ_PATH}/src/dev_console"
+ "fixtures"
)
# List all components that include tests here.
diff --git a/test/fixtures/CMakeLists.txt b/test/fixtures/CMakeLists.txt
new file mode 100644
index 00000000..fd98a7cd
--- /dev/null
+++ b/test/fixtures/CMakeLists.txt
@@ -0,0 +1 @@
+idf_component_register(INCLUDE_DIRS "." REQUIRES drivers)
diff --git a/test/fixtures/i2c_fixture.hpp b/test/fixtures/i2c_fixture.hpp
new file mode 100644
index 00000000..54794591
--- /dev/null
+++ b/test/fixtures/i2c_fixture.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "catch2/catch.hpp"
+#include "i2c.hpp"
+
+class I2CFixture {
+ public:
+ I2CFixture() { REQUIRE(drivers::init_i2c() == ESP_OK); }
+ ~I2CFixture() { drivers::deinit_i2c(); }
+};
diff --git a/test/fixtures/spi_fixture.hpp b/test/fixtures/spi_fixture.hpp
new file mode 100644
index 00000000..c2db484c
--- /dev/null
+++ b/test/fixtures/spi_fixture.hpp
@@ -0,0 +1,10 @@
+#pragma once
+
+#include "catch2/catch.hpp"
+#include "spi.hpp"
+
+class SpiFixture {
+ public:
+ SpiFixture() { REQUIRE(drivers::init_spi() == ESP_OK); }
+ ~SpiFixture() { drivers::deinit_spi(); }
+};
diff --git a/test/sdkconfig.test b/test/sdkconfig.test
index 31f9f34f..1247298b 100644
--- a/test/sdkconfig.test
+++ b/test/sdkconfig.test
@@ -5,4 +5,4 @@ CONFIG_COMPILER_CXX_EXCEPTIONS_EMG_POOL_SIZE=0
CONFIG_COMPILER_CXX_RTTI=y
CONFIG_COMPILER_STACK_CHECK_MODE_STRONG=y
CONFIG_COMPILER_STACK_CHECK=y
-CONFIG_ESP_TASK_WDT=n
+CONFIG_ESP_TASK_WDT=y