Added test for freerdp version functions.
This commit is contained in:
parent
8f228163a8
commit
827b4f76ca
26
libfreerdp/core/test/CMakeLists.txt
Normal file
26
libfreerdp/core/test/CMakeLists.txt
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
set(MODULE_NAME "TestCore")
|
||||
set(MODULE_PREFIX "TEST_CORE")
|
||||
|
||||
set(${MODULE_PREFIX}_DRIVER ${MODULE_NAME}.c)
|
||||
|
||||
set(${MODULE_PREFIX}_TESTS
|
||||
TestVersion.c)
|
||||
|
||||
create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
${${MODULE_PREFIX}_DRIVER}
|
||||
${${MODULE_PREFIX}_TESTS})
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
||||
foreach(test ${${MODULE_PREFIX}_TESTS})
|
||||
get_filename_component(TestName ${test} NAME_WE)
|
||||
add_test(${TestName} ${TESTING_OUTPUT_DIRECTORY}/${MODULE_NAME} ${TestName})
|
||||
endforeach()
|
||||
|
||||
set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "FreeRDP/Core/Test")
|
||||
|
38
libfreerdp/core/test/TestVersion.c
Normal file
38
libfreerdp/core/test/TestVersion.c
Normal file
@ -0,0 +1,38 @@
|
||||
#include <freerdp/version.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
|
||||
int TestVersion(int argc, char* argv[])
|
||||
{
|
||||
char *version;
|
||||
char *git;
|
||||
char *build;
|
||||
int major = 0, minor = 0, revision = 0;
|
||||
|
||||
freerdp_get_version(&major, &minor, &revision);
|
||||
if (major != FREERDP_VERSION_MAJOR)
|
||||
return -1;
|
||||
|
||||
if (minor != FREERDP_VERSION_MINOR)
|
||||
return -1;
|
||||
|
||||
if (revision != FREERDP_VERSION_REVISION)
|
||||
return -1;
|
||||
|
||||
version = freerdp_get_version_string();
|
||||
if (!version)
|
||||
return -1;
|
||||
|
||||
git = freerdp_get_build_revision();
|
||||
if (!git)
|
||||
return -1;
|
||||
|
||||
if (strncmp(git, GIT_REVISION, sizeof(GIT_REVISION)))
|
||||
return -1;
|
||||
|
||||
build = freerdp_get_build_date();
|
||||
if (!build)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user