Private
Public Access
2
0

gtest: fix version test and change test cmake var name

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-05-20 15:40:28 +01:00
parent 521b6817d7
commit 94941f5100
3 changed files with 16 additions and 8 deletions

View File

@@ -1,11 +1,15 @@
find_package (GTest REQUIRED)
set(PROJECT_TEST_NAME "${PROJECT_NAME}_test")
set(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/src)
include_directories(${GTEST_INCLUDE_DIRS} ${COMMON_INCLUDES})
include_directories(
${GTEST_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/api
${PROJECT_SOURCE_DIR}/include
)
add_executable(${PROJECT_TEST_NAME} "maa_test.cxx")
target_link_libraries(${PROJECT_TEST_NAME} ${PROJECT_NAME_STR} ${GTEST_BOTH_LIBRARIES} maa pthread)
add_test(Basic ${PROJECT_TEST_NAME})

View File

@@ -1,8 +1,12 @@
#include "maa.h"
#include <maa.h>
#include "gtest/gtest.h"
#include "version.h"
using namespace maa;
TEST (basic, GetVersion) {
ASSERT_EQ(get_version(), 1);
/* Careful, this test will only attempt to check the returned version is valid,
* it doesn't try to check the version is a release one.
*/
TEST (basic, maa_get_version) {
char bar[64];
strcpy(bar, maa_get_version());
ASSERT_STREQ(maa_get_version(), gVERSION);
}