Skip to content

Commit

Permalink
Merge pull request #1095 from AntelopeIO/GH-641-libfc-tests
Browse files Browse the repository at this point in the history
Refactor libfc tests into one executable
  • Loading branch information
heifner authored Apr 28, 2023
2 parents b8be739 + ca7e9b1 commit bbeaf98
Show file tree
Hide file tree
Showing 25 changed files with 39 additions and 101 deletions.
31 changes: 20 additions & 11 deletions libraries/libfc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
add_subdirectory( crypto )
add_subdirectory( io )
add_subdirectory( network )
add_subdirectory( scoped_exit )
add_subdirectory( static_variant )
add_subdirectory( variant )
add_subdirectory( variant_estimated_size )
add_executable( test_fc
crypto/test_blake2.cpp
crypto/test_cypher_suites.cpp
crypto/test_hash_functions.cpp
crypto/test_k1_recover.cpp
crypto/test_modular_arithmetic.cpp
crypto/test_webauthn.cpp
io/test_cfile.cpp
io/test_json.cpp
io/test_tracked_storage.cpp
network/test_message_buffer.cpp
scoped_exit/test_scoped_exit.cpp
static_variant/test_static_variant.cpp
variant/test_variant.cpp
variant_estimated_size/test_variant_estimated_size.cpp
test_base64.cpp
main.cpp
)
target_link_libraries( test_fc fc )

add_executable( test_base64 test_base64.cpp )
target_link_libraries( test_base64 fc )

add_test(NAME test_base64 COMMAND test_base64 WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
add_test(NAME test_fc COMMAND test_fc WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
24 changes: 0 additions & 24 deletions libraries/libfc/test/crypto/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_blake2.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE blake2
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/exception/exception.hpp>
#include <fc/crypto/hex.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_cypher_suites.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE cypher_suites
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/crypto/public_key.hpp>
#include <fc/crypto/private_key.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_hash_functions.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE hash_functions
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/crypto/hex.hpp>
#include <fc/crypto/sha3.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_k1_recover.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE blake2
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/exception/exception.hpp>
#include <fc/crypto/hex.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_modular_arithmetic.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE modular_arithmetic
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/exception/exception.hpp>
#include <fc/crypto/hex.hpp>
Expand Down
4 changes: 2 additions & 2 deletions libraries/libfc/test/crypto/test_utils.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
uint32_t to_uint32(const std::string& s) {
inline uint32_t to_uint32(const std::string& s) {
size_t l = s.size();
return (uint32_t)std::stoul(s.c_str(), &l, 16);
}

bytes to_bytes(const std::string& source) {
inline bytes to_bytes(const std::string& source) {
BOOST_REQUIRE(!(source.length() % 2));
bytes output(source.length()/2);
fc::from_hex(source, output.data(), output.size());
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/crypto/test_webauthn.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE webauthn_test_mod
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/algorithm/string.hpp>

#include <fc/crypto/public_key.hpp>
Expand Down
14 changes: 0 additions & 14 deletions libraries/libfc/test/io/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/io/test_cfile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE io
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/io/cfile.hpp>

Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/io/test_json.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE io_json
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/io/json.hpp>
#include <fc/exception/exception.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/io/test_tracked_storage.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE tracked_storage
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <fc/container/tracked_storage.hpp>
#include <fc/io/persistence_util.hpp>
#include <boost/multi_index_container.hpp>
Expand Down
2 changes: 2 additions & 0 deletions libraries/libfc/test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define BOOST_TEST_MODULE libfc
#include <boost/test/included/unit_test.hpp>
4 changes: 0 additions & 4 deletions libraries/libfc/test/network/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/network/test_message_buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

#include <thread>

#define BOOST_TEST_MODULE message_buffer
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

namespace {
size_t mb_size(boost::asio::mutable_buffer& mb) {
Expand Down
4 changes: 0 additions & 4 deletions libraries/libfc/test/scoped_exit/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/scoped_exit/test_scoped_exit.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <fc/scoped_exit.hpp>

#define BOOST_TEST_MODULE scoped_exit
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

using namespace fc;

Expand Down
4 changes: 0 additions & 4 deletions libraries/libfc/test/static_variant/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/static_variant/test_static_variant.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE static_variant
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>
#include <fc/exception/exception.hpp>
#include <fc/static_variant.hpp>
#include <fc/variant.hpp>
Expand Down
3 changes: 1 addition & 2 deletions libraries/libfc/test/test_base64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE base64
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/crypto/base64.hpp>
#include <fc/exception/exception.hpp>
Expand Down
4 changes: 0 additions & 4 deletions libraries/libfc/test/variant/CMakeLists.txt

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/libfc/test/variant/test_variant.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE variant
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/variant_object.hpp>
#include <fc/exception/exception.hpp>
Expand Down
4 changes: 0 additions & 4 deletions libraries/libfc/test/variant_estimated_size/CMakeLists.txt

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#define BOOST_TEST_MODULE variant
#include <boost/test/included/unit_test.hpp>
#include <boost/test/unit_test.hpp>

#include <fc/variant_object.hpp>
#include <fc/exception/exception.hpp>
Expand Down

0 comments on commit bbeaf98

Please sign in to comment.