Skip to content

Instantly share code, notes, and snippets.

@elmodaddyb
Last active November 19, 2017 18:33
Show Gist options
  • Save elmodaddyb/1e5aad8c21d47e7da21441b3486dd9b9 to your computer and use it in GitHub Desktop.
Save elmodaddyb/1e5aad8c21d47e7da21441b3486dd9b9 to your computer and use it in GitHub Desktop.
Example Using GoogleTest
add_executable(testonlineservices
$<TARGET_OBJECTS:libgerbera>
main.cpp
testonlineservices.cpp
testonlineservices.h
)
include(DefFileName)
define_file_path_for_sources(testonlineservices)
include_directories(
${UPNP_INCLUDE_DIRS}
${UUID_INCLUDE_DIRS}
${MAGIC_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${LASTFMLIB_INCLUDE_DIRS}
${FFMPEG_INCLUDE_DIR}
${EXIF_INCLUDE_DIRS}
${TAGLIB_INCLUDE_DIRS}
${EXPAT_INCLUDE_DIRS}
${FFMPEGTHUMBNAILER_INCLUDE_DIR}
${DUKTAPE_INCLUDE_DIRS}
${MYSQL_INCLUDE_DIRS}
${SQLITE3_INCLUDE_DIRS}
)
target_link_libraries(testonlineservices
${UUID_LIBRARIES}
${UPNP_LIBRARIES}
${MAGIC_LIBRARIES}
${ZLIB_LIBRARIES}
${CURL_LIBRARIES}
${LASTFMLIB_LIBRARIES}
${FFMPEG_LIBRARIES}
${EXIF_LIBRARIES}
${TAGLIB_LIBRARIES}
${EXPAT_LIBRARIES}
${FFMPEGTHUMBNAILER_LIBRARIES}
${DUKTAPE_LIBRARIES}
${MYSQL_CLIENT_LIBS}
${SQLITE3_LIBRARIES}
)
target_link_libraries(testonlineservices
libgtest
libgmock
)
add_test(NAME testonlineservices
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMAND ./test/testonlineservices)
#include "gtest/gtest.h"
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
int ret = RUN_ALL_TESTS();
return ret;
}
#include <youtube_service.h>
#include "gtest/gtest.h"
using namespace zmm;
using namespace mxml;
TEST(OnlineServicesTest, ByDefaultTrueIsTrue) {
Ref<YouTubeService> yt(new YouTubeService());
EXPECT_EQ(true, true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment