Skip to content

Commit

Permalink
Format tests under ecflow/base
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosbento committed Sep 19, 2024
1 parent 55fb27c commit 93b355f
Show file tree
Hide file tree
Showing 22 changed files with 130 additions and 80 deletions.
1 change: 1 addition & 0 deletions libs/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ ecbuild_add_test(
ecflow_all
Threads::Threads
$<$<BOOL:${OPENSSL_FOUND}>:OpenSSL::SSL>
test_support
TEST_DEPENDS
u_parser
)
Expand Down
21 changes: 12 additions & 9 deletions libs/base/test/TestAlterCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/test/unit_test.hpp>

#include "TestHelper.hpp"
#include "TestNaming.hpp"
#include "ecflow/attribute/GenericAttr.hpp"
#include "ecflow/attribute/LateAttr.hpp"
#include "ecflow/base/cts/user/AlterCmd.hpp"
Expand Down Expand Up @@ -74,13 +75,15 @@ class TestDefsStateChanged {
};

BOOST_AUTO_TEST_CASE(test_add_log5) {
ECF_NAME_THIS_TEST();

// create once for all test below, then remove at the end
Log::create("test_add_log5.log");
BOOST_CHECK_MESSAGE(true, "stop boost test form complaining");
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_type_hybrid) {
cout << "Base:: ...test_alter_cmd_for_clock_type_hybrid\n";
ECF_NAME_THIS_TEST();

// In this test the suite has NO Clock attribute. It should get added automatically
// when a new clock is added, we should sync with the computer clock
Expand Down Expand Up @@ -117,7 +120,7 @@ BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_type_hybrid) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_type_real) {
cout << "Base:: ...test_alter_cmd_for_clock_type_real\n";
ECF_NAME_THIS_TEST();

// In this test the suite has NO Clock attribute. It should get added automatically
// when a new clock is added, we should sync with the computer clock
Expand Down Expand Up @@ -153,7 +156,7 @@ BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_type_real) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_sync) {
cout << "Base:: ...test_alter_cmd_for_clock_sync\n";
ECF_NAME_THIS_TEST();

// Add a suite with a hybrid clock set to the past, on switch to real time, should have todays date
// Since the clock exists on the suite, with another date, we must explicitly sync with computer
Expand Down Expand Up @@ -209,7 +212,7 @@ BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_sync) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_date) {
cout << "Base:: ...test_alter_cmd_for_clock_date\n";
ECF_NAME_THIS_TEST();

// In this test the suite has NO Clock attribute. It should get added automatically
Defs defs;
Expand Down Expand Up @@ -256,7 +259,7 @@ BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_date) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_gain) {
cout << "Base:: ...test_alter_cmd_for_clock_gain\n";
ECF_NAME_THIS_TEST();

// In this test the suite has NO Clock attribute. It should get added automatically
Defs defs;
Expand Down Expand Up @@ -323,7 +326,7 @@ BOOST_AUTO_TEST_CASE(test_alter_cmd_for_clock_gain) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd) {
cout << "Base:: ...test_alter_cmd\n";
ECF_NAME_THIS_TEST();

Defs defs;
suite_ptr s = defs.add_suite("suite");
Expand Down Expand Up @@ -1131,7 +1134,7 @@ void add_sorted_attributes(Node* node) {
}

BOOST_AUTO_TEST_CASE(test_alter_sort_attributes) {
cout << "Base:: ...test_alter_sort_attributes\n";
ECF_NAME_THIS_TEST();

Defs defs;
defs.set_server().add_or_update_user_variables("z", "z");
Expand Down Expand Up @@ -1171,7 +1174,7 @@ BOOST_AUTO_TEST_CASE(test_alter_sort_attributes) {
}

BOOST_AUTO_TEST_CASE(test_alter_sort_attributes_for_task) {
cout << "Base:: ...test_alter_sort_attributes_for_task\n";
ECF_NAME_THIS_TEST();

Defs defs;
suite_ptr s = defs.add_suite("suite");
Expand Down Expand Up @@ -1202,7 +1205,7 @@ BOOST_AUTO_TEST_CASE(test_alter_sort_attributes_for_task) {
}

BOOST_AUTO_TEST_CASE(test_alter_cmd_errors) {
cout << "Base:: ...test_alter_cmd_errors\n";
ECF_NAME_THIS_TEST();

Defs defs;
suite_ptr s = defs.add_suite("suite");
Expand Down
13 changes: 7 additions & 6 deletions libs/base/test/TestArchiveAndRestoreCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/test/unit_test.hpp>

#include "TestHelper.hpp"
#include "TestNaming.hpp"
#include "ecflow/base/cts/user/BeginCmd.hpp"
#include "ecflow/base/cts/user/DeleteCmd.hpp"
#include "ecflow/base/cts/user/PathsCmd.hpp"
Expand All @@ -37,7 +38,7 @@ BOOST_AUTO_TEST_CASE(test_add_log4) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_restore_suite) {
cout << "Base:: ...test_archive_and_restore_suite\n";
ECF_NAME_THIS_TEST();

// Please note: after archive we delete the children, hence any references to child refer to a different object

Expand Down Expand Up @@ -84,7 +85,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_suite) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_restore_family) {
cout << "Base:: ...test_archive_and_restore_family\n";
ECF_NAME_THIS_TEST();

// Create the defs file corresponding to the text below
// suite suite
Expand Down Expand Up @@ -130,7 +131,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_family) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_restore_all) {
cout << "Base:: ...test_archive_and_restore_all\n";
ECF_NAME_THIS_TEST();

// Create the defs file corresponding to the text below
// suite suite
Expand Down Expand Up @@ -233,7 +234,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_all) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_restore_overlap) {
cout << "Base:: ...test_archive_and_restore_overlap\n";
ECF_NAME_THIS_TEST();

// Create the defs file corresponding to the text below
// suite suite
Expand Down Expand Up @@ -276,7 +277,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_restore_overlap) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_delete_suite) {
cout << "Base:: ...test_archive_and_delete_suite\n";
ECF_NAME_THIS_TEST();

// Create the defs file corresponding to the text below
// suite suite
Expand Down Expand Up @@ -315,7 +316,7 @@ BOOST_AUTO_TEST_CASE(test_archive_and_delete_suite) {
}

BOOST_AUTO_TEST_CASE(test_archive_and_restore_errors) {
cout << "Base:: ...test_archive_and_restore_errors\n";
ECF_NAME_THIS_TEST();

// Create the defs file corresponding to the text below
// suite suite
Expand Down
13 changes: 7 additions & 6 deletions libs/base/test/TestClientHandleCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <boost/test/unit_test.hpp>

#include "TestHelper.hpp"
#include "TestNaming.hpp"
#include "ecflow/base/cts/user/ClientHandleCmd.hpp"
#include "ecflow/base/cts/user/OrderNodeCmd.hpp"
#include "ecflow/core/Converter.hpp"
Expand All @@ -33,7 +34,7 @@ BOOST_AUTO_TEST_CASE(test_add_log3) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_cmd_empty_server) {
cout << "Base:: ...test_client_handle_cmd_empty_server\n";
ECF_NAME_THIS_TEST();

std::vector<std::string> suite_names;
suite_names.reserve(5);
Expand Down Expand Up @@ -87,7 +88,7 @@ BOOST_AUTO_TEST_CASE(test_client_handle_cmd_empty_server) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_cmd_register_and_drop) {
cout << "Base:: ...test_client_handle_cmd_register_and_drop\n";
ECF_NAME_THIS_TEST();

std::vector<std::string> suite_names;
suite_names.reserve(6);
Expand Down Expand Up @@ -120,7 +121,7 @@ BOOST_AUTO_TEST_CASE(test_client_handle_cmd_register_and_drop) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_cmd_register__with_drop) {
cout << "Base:: ...test_client_handle_cmd_register_with_drop\n";
ECF_NAME_THIS_TEST();

std::vector<std::string> suite_names;
suite_names.reserve(6);
Expand Down Expand Up @@ -164,7 +165,7 @@ BOOST_AUTO_TEST_CASE(test_client_handle_cmd_register__with_drop) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_cmd_auto_add) {
cout << "Base:: ...test_client_handle_cmd_auto_add\n";
ECF_NAME_THIS_TEST();

std::vector<std::string> suite_names;
suite_names.reserve(6);
Expand Down Expand Up @@ -222,7 +223,7 @@ BOOST_AUTO_TEST_CASE(test_client_handle_cmd_auto_add) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_cmd_add_remove) {
cout << "Base:: ...test_client_handle_cmd_add_remove\n";
ECF_NAME_THIS_TEST();

std::vector<std::string> suite_names;
suite_names.reserve(6);
Expand Down Expand Up @@ -312,7 +313,7 @@ static bool check_ordering(Defs& defs) {
}

BOOST_AUTO_TEST_CASE(test_client_handle_suite_ordering) {
cout << "Base:: ...test_client_handle_suite_ordering\n";
ECF_NAME_THIS_TEST();
// ensure order of suites in a handle is the same as server suites

std::vector<std::string> suite_names;
Expand Down
4 changes: 3 additions & 1 deletion libs/base/test/TestCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <boost/test/unit_test.hpp>

#include "TestHelper.hpp"
#include "TestNaming.hpp"
#include "ecflow/base/cts/task/AbortCmd.hpp"
#include "ecflow/base/cts/user/BeginCmd.hpp"
#include "ecflow/base/cts/user/CtsCmd.hpp"
Expand All @@ -33,7 +34,8 @@ BOOST_AUTO_TEST_SUITE(U_Base)
BOOST_AUTO_TEST_SUITE(T_Cmd)

BOOST_AUTO_TEST_CASE(test_simple_cmd) {
cout << "Base:: ...test_simple_cmd\n";
ECF_NAME_THIS_TEST();

TestLog test_log("test_simple_cmd.log"); // will create log file, and destroy log and remove file at end of scope

// Create the defs file. Note that the default ECF_TRIES = 3
Expand Down
6 changes: 4 additions & 2 deletions libs/base/test/TestDeleteNodeCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "MockServer.hpp"
#include "MyDefsFixture.hpp"
#include "TestNaming.hpp"
#include "ecflow/base/cts/user/DeleteCmd.hpp"
#include "ecflow/base/cts/user/PathsCmd.hpp"
#include "ecflow/base/stc/ServerToClientCmd.hpp"
Expand All @@ -25,7 +26,8 @@ BOOST_AUTO_TEST_SUITE(U_Base)
BOOST_AUTO_TEST_SUITE(T_DeleteNodeCmd)

BOOST_AUTO_TEST_CASE(test_delete_node_cmd) {
cout << "Base:: ...test_delete_node_cmd\n";
ECF_NAME_THIS_TEST();

TestLog test_log(
"test_delete_node_cmd.log"); // will create log file, and destroy log and remove file at end of scope

Expand Down Expand Up @@ -185,7 +187,7 @@ BOOST_AUTO_TEST_CASE(test_delete_node_cmd) {
}

BOOST_AUTO_TEST_CASE(test_delete_node_edit_history_ECFLOW_1684) {
cout << "Base:: ...test_delete_node_edit_history_ECFLOW_1684\n";
ECF_NAME_THIS_TEST();

// This test will ensure that if a suite/family node is deleted, we *remove* any *OLD* edit history associated
// with the node, AND and of its children
Expand Down
Loading

0 comments on commit 93b355f

Please sign in to comment.