Skip to content

Commit

Permalink
Moved ssl_options unit tests to Catch2
Browse files Browse the repository at this point in the history
  • Loading branch information
fpagliughi committed Oct 24, 2020
1 parent 98da500 commit 4a5de0d
Show file tree
Hide file tree
Showing 6 changed files with 342 additions and 328 deletions.
6 changes: 3 additions & 3 deletions cmake/FindPahoMqttC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ else()
set(_PAHO_MQTT_C_LIB_NAME paho-mqtt3a)
endif()
# add suffix when using static Paho MQTT C library variant
if(PAHO_BUILD_STATIC)
set(_PAHO_MQTT_C_LIB_NAME ${_PAHO_MQTT_C_LIB_NAME}-static)
endif()
#if(PAHO_BUILD_STATIC)
# set(_PAHO_MQTT_C_LIB_NAME ${_PAHO_MQTT_C_LIB_NAME}-static)
#endif()

find_library(PAHO_MQTT_C_LIBRARIES NAMES ${_PAHO_MQTT_C_LIB_NAME})
unset(_PAHO_MQTT_C_LIB_NAME)
Expand Down
9 changes: 7 additions & 2 deletions src/mqtt/ssl_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ class ssl_options

/** The connect options has special access */
friend class connect_options;
friend class connect_options_test;
friend class ssl_options_test;
//friend class connect_options_test;

/**
* Gets a pointer to the C-language NUL-terminated strings for the
Expand Down Expand Up @@ -144,6 +143,12 @@ class ssl_options
* @return A reference to this object.
*/
ssl_options& operator=(ssl_options&& opt);
/**
* Expose the underlying C struct for the unit tests.
*/
#if defined(UNIT_TESTS)
const MQTTAsync_SSLOptions& c_struct() const { return opts_; }
#endif
/**
* Returns the file containing the public digital certificates trusted by
* the client.
Expand Down
318 changes: 0 additions & 318 deletions test/cppunit/ssl_options_test.h

This file was deleted.

5 changes: 0 additions & 5 deletions test/cppunit/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "async_client_test.h"
#include "async_client_v3_test.h"
#include "client_test.h"
#include "ssl_options_test.h"
#include "disconnect_options_test.h"
#include "response_options_test.h"
#include "delivery_response_options_test.h"
Expand All @@ -33,10 +32,6 @@ using namespace CppUnit;

int main(int argc, char* argv[])
{
#if defined(OPENSSL)
CPPUNIT_TEST_SUITE_REGISTRATION( mqtt::ssl_options_test );
#endif

CPPUNIT_TEST_SUITE_REGISTRATION( mqtt::disconnect_options_test );
CPPUNIT_TEST_SUITE_REGISTRATION( mqtt::response_options_test );

Expand Down
4 changes: 4 additions & 0 deletions test/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ add_executable(unit_tests unit_tests.cpp
test_will_options.cpp
)

if(PAHO_WITH_SSL)
target_sources(unit_tests PUBLIC test_ssl_options.cpp)
endif()

# --- Link for executables ---

message(STATUS "Using library for unit tests: ${PAHO_CPP_LIB}")
Expand Down
Loading

0 comments on commit 4a5de0d

Please sign in to comment.