aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-06-11 21:04:30 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-06-11 21:30:22 +0200
commit9029ebde3b624c52a3cca516a8b055e1cebb0ffa (patch)
tree5e32c699277f1016ebce1482fe43ef659abd0d2a
parent362af2683310518720df7309291a76ef3a170bde (diff)
downloadnextpnr-9029ebde3b624c52a3cca516a8b055e1cebb0ffa.tar.gz
nextpnr-9029ebde3b624c52a3cca516a8b055e1cebb0ffa.tar.bz2
nextpnr-9029ebde3b624c52a3cca516a8b055e1cebb0ffa.zip
Added dummy tests per arch
-rw-r--r--.gitignore7
-rw-r--r--CMakeLists.txt8
-rw-r--r--tests/dummy/main.cpp18
-rw-r--r--tests/ice40/main.cpp18
4 files changed, 48 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index a7d4313e..5f4df35c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,7 @@
/generated/
/objs/
-/nextpnr-dummy
-/nextpnr-ice40
+/nextpnr-dummy*
+/nextpnr-ice40*
cmake-build-*/
Makefile
cmake_install.cmake
@@ -21,4 +21,5 @@ a.out
build/
*.asc
*.bin
-
+CTest*
+LastTest*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 54b4c129..03dc1855 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,6 +22,9 @@ execute_process(
OUTPUT_STRIP_TRAILING_WHITESPACE
)
+add_subdirectory(3rdparty/googletest/googletest)
+enable_testing()
+
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/common/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/generated/version.h
@@ -96,6 +99,11 @@ foreach (family ${FAMILIES})
target_compile_definitions(${target} PRIVATE ARCH_${ufamily} ARCHNAME=${family} -DQT_NO_KEYWORDS)
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES})
endforeach (target)
+
+ add_executable(nextpnr-${family}-test "")
+ target_sources(nextpnr-${family}-test PRIVATE tests/${family}/main.cpp)
+ target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
+ add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
endforeach (family)
file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h)
diff --git a/tests/dummy/main.cpp b/tests/dummy/main.cpp
new file mode 100644
index 00000000..b8d22138
--- /dev/null
+++ b/tests/dummy/main.cpp
@@ -0,0 +1,18 @@
+#include "gtest/gtest.h"
+
+#include <vector>
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+TEST(example, sum_zero) {
+ auto result = 0;
+ ASSERT_EQ(result, 0);
+}
+
+TEST(example, sum_five) {
+ auto result = 15;
+ ASSERT_EQ(result, 15);
+}
diff --git a/tests/ice40/main.cpp b/tests/ice40/main.cpp
new file mode 100644
index 00000000..b8d22138
--- /dev/null
+++ b/tests/ice40/main.cpp
@@ -0,0 +1,18 @@
+#include "gtest/gtest.h"
+
+#include <vector>
+
+int main(int argc, char **argv) {
+ ::testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+
+TEST(example, sum_zero) {
+ auto result = 0;
+ ASSERT_EQ(result, 0);
+}
+
+TEST(example, sum_five) {
+ auto result = 15;
+ ASSERT_EQ(result, 15);
+}