From f0fa92c6c431e15f2012003bd35e6e474d7fca8f Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sun, 15 Jul 2012 16:48:59 +0100 Subject: [PATCH] Added empty unit testing framework --- .gitignore | 3 +++ CMakeLists.txt | 19 ++++++++++++++++++- test/test.cpp | 22 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 test/test.cpp diff --git a/.gitignore b/.gitignore index ea84893e..9daf758c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,13 @@ sigrok-qt2 +sigrok-qt2-test # CMake cruft CMakeCache.txt CMakeFiles/ cmake_install.cmake +CTestTestfile.cmake Makefile +Testing/ # qt generated code *.qrc.depends diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f99a4bb..445cb630 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ pkg_check_modules(PKGDEPS REQUIRED ) find_package(Qt4 REQUIRED) -find_package(Boost 1.46 REQUIRED) +find_package(Boost 1.46 COMPONENTS unit_test_framework REQUIRED) set(VERSION 0.1.0) @@ -45,6 +45,10 @@ set(sigrok-qt2_RESOURCES sigrok-qt2.qrc ) +set(sigrok-qt2_TEST_SOURCES + test/test.cpp +) + set(QT_USE_QTOPENGL TRUE) qt4_wrap_cpp(sigrok-qt2_HEADERS_MOC ${sigrok-qt2_HEADERS}) @@ -79,3 +83,16 @@ target_link_libraries(sigrok-qt2 ${PKGDEPS_LIBRARIES} ${QT_LIBRARIES} ) + +add_definitions(-DBOOST_TEST_DYN_LINK) + +add_executable(sigrok-qt2-test + ${sigrok-qt2_TEST_SOURCES} +) + +target_link_libraries(sigrok-qt2-test + ${Boost_LIBRARIES} +) + +enable_testing() +add_test(test ${CMAKE_CURRENT_BINARY_DIR}/sigrok-qt2-test) diff --git a/test/test.cpp b/test/test.cpp new file mode 100644 index 00000000..2c278c04 --- /dev/null +++ b/test/test.cpp @@ -0,0 +1,22 @@ +/* + * This file is part of the sigrok project. + * + * Copyright (C) 2012 Joel Holdsworth + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#define BOOST_TEST_MAIN +#include -- 2.30.2