Skip to content

Commit

Permalink
Add cmake build for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karekoho committed Jul 22, 2017
1 parent 886b45c commit 176e9f3
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 24 deletions.
35 changes: 35 additions & 0 deletions build/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.0.2)
project(tests_release)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(PATH "../../src/tests/")
set(SOURCES
${PATH}main.cpp
${PATH}json_array_iterator_test.h
${PATH}json_exception_test.h
${PATH}json_mock_value.h
${PATH}json_object_iterator_test.h
${PATH}json_test.h
${PATH}json_value_test_interface.h
${PATH}unit_test.h
${PATH}json_array_test.h
${PATH}json_leaf_iterator_test.h
${PATH}json_null_test.h
${PATH}json_object_test.h
${PATH}json_undefined_test.h
${PATH}test_selector.h
${PATH}json_boolean_test.h
${PATH}json_leaf_test.h
${PATH}json_number_test.h
${PATH}json_string_test.h
${PATH}json_value_test.h
${PATH}test_selector_test.h)

find_library (CPPUNIT_LIB cppunit)
find_library (JSON_LIB json)

message(${CPPUNIT_LIB})
message(${JSON_LIB})

add_executable (tests_release ${SOURCES})
target_link_libraries (tests_release ${CPPUNIT_LIB} ${JSON_LIB})
2 changes: 1 addition & 1 deletion src/tests/json_exception_test.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef JSON_EXCEPTION_TEST
#define JSON_EXCEPTION_TEST

#include <unit_test.h>
#include "unit_test.h"
#include "json_exception_test.h"

/**
Expand Down
2 changes: 1 addition & 1 deletion src/tests/json_test.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef JSON_TEST_H
#define JSON_TEST_H

#include <json_value_test_interface.h>
#include "json_value_test_interface.h"
#include "json_mock_value.h"

namespace format
Expand Down
2 changes: 1 addition & 1 deletion src/tests/json_value_test.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef JSON_INTERFACE_TEST_H
#define JSON_INTERFACE_TEST_H

#include <json_value_test_interface.h>
#include "json_value_test_interface.h"
#include "json_mock_value.h"

namespace format
Expand Down
2 changes: 1 addition & 1 deletion src/tests/json_value_test_interface.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef JSON_VALUE_TEST_H
#define JSON_VALUE_TEST_H

#include <unit_test.h>
#include "unit_test.h"

/**
* @brief The json_value_test_interface class
Expand Down
32 changes: 16 additions & 16 deletions src/tests/main.cpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#include <unit_test.h>
#include <json_value_test.h>
#include <json_test.h>
#include <json_object_test.h>
#include <json_string_test.h>
#include <json_array_test.h>
#include <json_number_test.h>
#include <json_boolean_test.h>
#include <json_null_test.h>
#include <json_undefined_test.h>
#include <json_leaf_test.h>
#include <json_object_iterator_test.h>
#include <json_array_iterator_test.h>
#include <json_leaf_iterator_test.h>
#include <test_selector_test.h>
#include <json_exception_test.h>
#include "unit_test.h"
#include "json_value_test.h"
#include "json_test.h"
#include "json_object_test.h"
#include "json_string_test.h"
#include "json_array_test.h"
#include "json_number_test.h"
#include "json_boolean_test.h"
#include "json_null_test.h"
#include "json_undefined_test.h"
#include "json_leaf_test.h"
#include "json_object_iterator_test.h"
#include "json_array_iterator_test.h"
#include "json_leaf_iterator_test.h"
#include "test_selector_test.h"
#include "json_exception_test.h"

#include <cstdlib>

Expand Down
2 changes: 1 addition & 1 deletion src/tests/test_selector.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TEST_SELECTOR
#define TEST_SELECTOR

#include <unit_test.h>
#include "unit_test.h"

#include <vector>
#include <cstring>
Expand Down
5 changes: 3 additions & 2 deletions src/tests/tests.pro
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ LIBS += -L/usr/local/lib -lcppunit

QMAKE_CXXFLAGS+= -std=c++11
QMAKE_LFLAGS += -std=c++11
#QMAKE_CXXFLAGS+= -std=c++14
#QMAKE_LFLAGS += -std=c++14

TARGET = tests_development
CONFIG += console
Expand Down Expand Up @@ -61,5 +59,8 @@ HEADERS += \
SUBDIRS += \
../json/json.pro

DISTFILES += \
../../build/tests/CMakeLists.txt



3 changes: 2 additions & 1 deletion src/tests/unit_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
#include <array>
#include <wchar.h>

#include "../json/json.h"
//#include "../json/json.h"
#include <format/json.h>

#define PASS 0
#define FAIL 1
Expand Down

0 comments on commit 176e9f3

Please sign in to comment.