Merge pull request #3 from milkcocoa0902/develop
merge branch develop into master
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
third/* linguist-vendored
|
||||||
|
help/* linguist-documentation
|
||||||
+5
-5
@@ -49,6 +49,7 @@ if(ENABLE_CODE_COVERAGE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Required libraries
|
# Required libraries
|
||||||
|
find_package(Boost 1.71.0 COMPONENTS unit_test_framework REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
if(NOT OPENSSL_FOUND)
|
if(NOT OPENSSL_FOUND)
|
||||||
@@ -63,14 +64,13 @@ if(NOT CURL_FOUND)
|
|||||||
endif()
|
endif()
|
||||||
include_directories(${CURL_INCLUDE_DIRS})
|
include_directories(${CURL_INCLUDE_DIRS})
|
||||||
|
|
||||||
find_library(cpprest REQUIRED)
|
|
||||||
include_directories(${CPP_REST_INCLUDE_DIR})
|
|
||||||
|
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${PROJECT_SOURCE_DIR}/src
|
${PROJECT_SOURCE_DIR}/src
|
||||||
${PROJECT_SOURCE_DIR}/third
|
${PROJECT_SOURCE_DIR}/third
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Enable CTest
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
#add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ doxygen \
|
|||||||
git \
|
git \
|
||||||
graphviz \
|
graphviz \
|
||||||
libboost-dev \
|
libboost-dev \
|
||||||
|
libboost-test-dev \
|
||||||
libcurl4-openssl-dev \
|
libcurl4-openssl-dev \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
|
|||||||
Vendored
+15
-1
@@ -1,3 +1,5 @@
|
|||||||
|
def unittestBadge = addEmbeddableBadgeConfiguration(id: "unittest", subject: "unit test")
|
||||||
|
|
||||||
pipeline {
|
pipeline {
|
||||||
agent {
|
agent {
|
||||||
dockerfile true
|
dockerfile true
|
||||||
@@ -40,7 +42,19 @@ pipeline {
|
|||||||
|
|
||||||
stage("test"){
|
stage("test"){
|
||||||
steps{
|
steps{
|
||||||
echo "test"
|
script{
|
||||||
|
unittestBadge.setStatus('running')
|
||||||
|
try{
|
||||||
|
sh '''
|
||||||
|
cd build
|
||||||
|
ctest --output_on_failure
|
||||||
|
'''
|
||||||
|
unittestBadge.setStatus('passing')
|
||||||
|
}catch(Exception error){
|
||||||
|
unittestBadge.setStatus('failed')
|
||||||
|
error 'unittest failed'
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
# CocoaTweet
|
# CocoaTweet
|
||||||
This is a library for using Twitter API from C++
|
This is a library for using Twitter API from C++
|
||||||
|
|
||||||
|
|||||||
+1
-6
@@ -2,9 +2,4 @@ add_subdirectory(cocoatweet)
|
|||||||
|
|
||||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
|
||||||
add_executable(${PROJECT_NAME} main.cc)
|
add_executable(${PROJECT_NAME} main.cc)
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME} lib-cocoatweet)
|
||||||
lib-cocoatweet
|
|
||||||
OpenSSL::SSL
|
|
||||||
OpenSSL::Crypto
|
|
||||||
${CURL_LIBRARIES}
|
|
||||||
)
|
|
||||||
@@ -1,4 +1,11 @@
|
|||||||
file(GLOB_RECURSE SOURCES ./*.cc)
|
file(GLOB_RECURSE SOURCES ./*.cc)
|
||||||
add_library(lib-cocoatweet ${SOURCES})
|
add_library(lib-cocoatweet ${SOURCES})
|
||||||
|
target_link_libraries(lib-cocoatweet PUBLIC
|
||||||
|
Boost::boost
|
||||||
|
OpenSSL::SSL
|
||||||
|
OpenSSL::Crypto
|
||||||
|
${CURL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
target_include_directories(lib-cocoatweet PUBLIC ${PROJECT_SOURCE_DIR}/src)
|
target_include_directories(lib-cocoatweet PUBLIC ${PROJECT_SOURCE_DIR}/src)
|
||||||
set_target_properties(lib-cocoatweet PROPERTIES OUTPUT_NAME cocoatweet)
|
set_target_properties(lib-cocoatweet PROPERTIES OUTPUT_NAME cocoatweet)
|
||||||
|
|||||||
@@ -11,7 +11,11 @@ class Key {
|
|||||||
const std::string accessTokenSecret_;
|
const std::string accessTokenSecret_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Key() = default;
|
Key()
|
||||||
|
: consumerKey_(""),
|
||||||
|
consumerSecret_(""),
|
||||||
|
accessToken_(""),
|
||||||
|
accessTokenSecret_("") {}
|
||||||
Key(const std::string& _consumerKey, const std::string& _consumerSecret,
|
Key(const std::string& _consumerKey, const std::string& _consumerSecret,
|
||||||
const std::string& _accessToken, const std::string& _accessTokenSecret)
|
const std::string& _accessToken, const std::string& _accessTokenSecret)
|
||||||
: consumerKey_(_consumerKey),
|
: consumerKey_(_consumerKey),
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
file(GLOB_RECURSE SOURCES ./*.cc)
|
||||||
|
|
||||||
|
foreach(TEST_SOURCE_FILE ${SOURCES})
|
||||||
|
file(RELATIVE_PATH SRC_RELPATH ${CMAKE_CURRENT_LIST_DIR} ${TEST_SOURCE_FILE})
|
||||||
|
string(REGEX REPLACE "\.cc$" "" TEST_MODULE_NAME "test/${SRC_RELPATH}")
|
||||||
|
string(REPLACE "/" "_" TEST_EXECUTABLE_NAME ${TEST_MODULE_NAME})
|
||||||
|
|
||||||
|
add_executable(${TEST_EXECUTABLE_NAME} ${TEST_SOURCE_FILE})
|
||||||
|
target_compile_definitions(${TEST_EXECUTABLE_NAME} PRIVATE BOOST_TEST_MODULE=${TEST_MODULE_NAME})
|
||||||
|
target_link_libraries(${TEST_EXECUTABLE_NAME}
|
||||||
|
lib-cocoatweet
|
||||||
|
Boost::unit_test_framework
|
||||||
|
)
|
||||||
|
add_test(${TEST_MODULE_NAME} ${EXECUTABLE_OUTPUT_PATH}/${TEST_EXECUTABLE_NAME})
|
||||||
|
endforeach()
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
#define BOOST_TEST_DYN_LINK
|
||||||
|
|
||||||
|
#include <boost/test/included/unit_test.hpp>
|
||||||
|
|
||||||
|
#include "cocoatweet/oauth/key.h"
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_SUITE(oauth_key)
|
||||||
|
BOOST_AUTO_TEST_CASE(test01) {
|
||||||
|
CocoaTweet::OAuth::Key key;
|
||||||
|
|
||||||
|
BOOST_TEST(key.consumerKey() == "");
|
||||||
|
BOOST_TEST(key.consumerSecret() == "");
|
||||||
|
BOOST_TEST(key.accessToken() == "");
|
||||||
|
BOOST_TEST(key.accessTokenSecret() == "");
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(test02) {
|
||||||
|
CocoaTweet::OAuth::Key key("consumerKey", "consumerSecret", "accessToken", "accessTokenSecret");
|
||||||
|
|
||||||
|
BOOST_TEST(key.consumerKey() == "consumerKey");
|
||||||
|
BOOST_TEST(key.consumerSecret() == "consumerSecret");
|
||||||
|
BOOST_TEST(key.accessToken() == "accessToken");
|
||||||
|
BOOST_TEST(key.accessTokenSecret() == "accessTokenSecret");
|
||||||
|
|
||||||
|
auto noSecret = key.noSecret();
|
||||||
|
BOOST_TEST(noSecret.at("oauth_consumer_key") == "consumerKey");
|
||||||
|
BOOST_TEST(noSecret.at("oauth_token") == "accessToken");
|
||||||
|
|
||||||
|
auto secret = key.secret();
|
||||||
|
BOOST_TEST(secret.at("oauth_consumer_key") == "consumerSecret");
|
||||||
|
BOOST_TEST(secret.at("oauth_token") == "accessTokenSecret");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
Reference in New Issue
Block a user