Skip to content

Commit

Permalink
Clean-up test artefacts from core library
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento authored Dec 20, 2023
2 parents d285a46 + 9b72375 commit ec5841a
Show file tree
Hide file tree
Showing 20 changed files with 198 additions and 180 deletions.
19 changes: 17 additions & 2 deletions ACore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ set(srcs
src/ecflow/core/PrintStyle.hpp
src/ecflow/core/SState.hpp
src/ecflow/core/Serialization.hpp
src/ecflow/core/SerializationTest.hpp
src/ecflow/core/Stl.hpp
src/ecflow/core/Str.hpp
src/ecflow/core/StringSplitter.hpp
src/ecflow/core/TestUtil.hpp
src/ecflow/core/TimeSeries.hpp
src/ecflow/core/TimeSlot.hpp
src/ecflow/core/TimeStamp.hpp
Expand Down Expand Up @@ -120,6 +118,22 @@ ecbuild_add_library(
)
target_clangformat(core)

##
## Notice: test_support is an INTERFACE-only test utility library.
##

ecbuild_add_library(
TARGET
test_support
NOINSTALL
TYPE INTERFACE
SOURCES
test/TestSerialisation.hpp
PUBLIC_INCLUDES
test
)
target_clangformat(test_support)

set(test_srcs
# Headers
test/TestVersioning.hpp
Expand Down Expand Up @@ -164,6 +178,7 @@ ecbuild_add_test(
SOURCES
${test_srcs}
LIBS
test_support
core
Boost::boost # Boost header-only libraries must be available (namely unit_test_framework)
#
Expand Down
12 changes: 10 additions & 2 deletions ACore/src/ecflow/core/Str.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ namespace ecf {

namespace algorithm {

template <typename Sequence1, typename Sequence2>
inline static auto join(const Sequence1& strings, const Sequence2& separator) {
template <typename Sequence1, typename Sequence2 = std::string>
inline static auto join(const Sequence1& strings, const Sequence2& separator = std::string(", ")) {
return ::boost::algorithm::join(strings, separator);
}

Expand All @@ -48,6 +48,14 @@ inline static void trim(Sequence& input) {
::boost::algorithm::trim(input);
}

template <typename T>
static std::vector<std::string> transform_to_name_vector(const std::vector<T>& i) {
std::vector<std::string> o;
o.reserve(i.size());
std::transform(std::begin(i), std::end(i), std::back_inserter(o), [](const auto& v) { return v->name(); });
return o;
}

} // namespace algorithm

class Str {
Expand Down
43 changes: 0 additions & 43 deletions ACore/src/ecflow/core/TestUtil.hpp

This file was deleted.

2 changes: 1 addition & 1 deletion ACore/test/TestCereal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

#include <boost/test/unit_test.hpp>

#include "TestSerialisation.hpp"
#include "ecflow/core/Filesystem.hpp"
#include "ecflow/core/SerializationTest.hpp"

using namespace ecf;
using namespace boost;
Expand Down
2 changes: 1 addition & 1 deletion ACore/test/TestCerealOptionalNVP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <boost/test/unit_test.hpp>

#include "ecflow/core/Filesystem.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/core/Serialization.hpp"

using namespace ecf;
using namespace boost;
Expand Down
2 changes: 1 addition & 1 deletion ACore/test/TestMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

#include <boost/test/unit_test.hpp>

#include "TestSerialisation.hpp"
#include "ecflow/core/Calendar.hpp"
#include "ecflow/core/DState.hpp"
#include "ecflow/core/Ecf.hpp"
#include "ecflow/core/File.hpp"
#include "ecflow/core/NState.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/core/TimeSeries.hpp"

using namespace std;
Expand Down
3 changes: 2 additions & 1 deletion ACore/test/TestSerialisation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
* nor does it submit to any jurisdiction.
*/

#include "TestSerialisation.hpp"

#include <boost/test/unit_test.hpp>

#include "ecflow/core/Calendar.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/core/TimeSeries.hpp"

using namespace std;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
* nor does it submit to any jurisdiction.
*/

#ifndef ecflow_core_SerializationTest_HPP
#define ecflow_core_SerializationTest_HPP
#ifndef ecflow_core_TestSerialisation_HPP
#define ecflow_core_TestSerialisation_HPP

#include <boost/test/unit_test.hpp>

#include "ecflow/core/Serialization.hpp"

namespace ecf {

// The following template functions are used test/debug only
template <typename T>
void do_restore(const std::string& fileName, const T& saved) {
T restored;
Expand Down Expand Up @@ -66,4 +65,4 @@ void doSaveAndRestore(const std::string& fileName) {

} // namespace ecf

#endif /* ecflow_core_SerializationTest_HPP */
#endif /* ecflow_core_TestSerialisation_HPP */
2 changes: 1 addition & 1 deletion ACore/test/TestVersioning.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
#ifndef ecflow_core_test_TestVersioning_HPP
#define ecflow_core_test_TestVersioning_HPP

#include "TestSerialisation.hpp"
#include "ecflow/core/Converter.hpp"
#include "ecflow/core/SerializationTest.hpp"

/// To simulate changing of data model over time, we will
/// namespace's. The actual serialisation does not appears to
Expand Down
1 change: 1 addition & 0 deletions ANattr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ ecbuild_add_test(
SOURCES
${test_srcs}
LIBS
test_support
nodeattr
TEST_DEPENDS
u_acore
Expand Down
2 changes: 1 addition & 1 deletion ANattr/test/TestAttrSerialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <boost/test/unit_test.hpp>

#include "TestSerialisation.hpp"
#include "ecflow/attribute/AutoArchiveAttr.hpp"
#include "ecflow/attribute/AutoCancelAttr.hpp"
#include "ecflow/attribute/ClockAttr.hpp"
Expand All @@ -27,7 +28,6 @@
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/attribute/ZombieAttr.hpp"
#include "ecflow/core/Calendar.hpp"
#include "ecflow/core/SerializationTest.hpp"

using namespace std;
using namespace ecf;
Expand Down
2 changes: 1 addition & 1 deletion ANattr/test/TestMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/test/unit_test.hpp>

#include "TestSerialisation.hpp"
#include "ecflow/attribute/AutoArchiveAttr.hpp"
#include "ecflow/attribute/AutoCancelAttr.hpp"
#include "ecflow/attribute/ClockAttr.hpp"
Expand All @@ -28,7 +29,6 @@
#include "ecflow/attribute/VerifyAttr.hpp"
#include "ecflow/attribute/ZombieAttr.hpp"
#include "ecflow/core/File.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/core/TimeSlot.hpp"
#include "ecflow/core/cereal_boost_time.hpp"

Expand Down
1 change: 1 addition & 0 deletions ANode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ ecbuild_add_test(
SOURCES
${test_srcs}
LIBS
test_support
node
Boost::boost # Boost header-only libraries must be available (namely unit_test_framework)
TEST_DEPENDS
Expand Down
2 changes: 1 addition & 1 deletion ANode/test/TestInLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <boost/test/unit_test.hpp>

#include "ecflow/core/SerializationTest.hpp"
#include "TestSerialisation.hpp"
#include "ecflow/node/InLimit.hpp"
#include "ecflow/node/Task.hpp"

Expand Down
2 changes: 1 addition & 1 deletion ANode/test/TestLimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

#include <boost/test/unit_test.hpp>

#include "TestSerialisation.hpp"
#include "ecflow/core/Converter.hpp"
#include "ecflow/core/Ecf.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/node/Limit.hpp"

using namespace std;
Expand Down
2 changes: 1 addition & 1 deletion ANode/test/TestMigration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
#include <boost/test/unit_test.hpp>

#include "MyDefsFixture.hpp"
#include "TestSerialisation.hpp"
#include "ecflow/core/Ecf.hpp"
#include "ecflow/core/File.hpp"
#include "ecflow/core/SerializationTest.hpp"
#include "ecflow/node/Defs.hpp"
#include "ecflow/node/Family.hpp"
#include "ecflow/node/Suite.hpp"
Expand Down
Loading

0 comments on commit ec5841a

Please sign in to comment.