From c4726e3477abcd311127cd1cd68a544af3f0cd49 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 27 Dec 2024 12:27:18 -0600 Subject: [PATCH 01/59] Start of adding mermaid graphs --- include/pluginplay/printing/mermaid.hpp | 19 ++++++++++++++++ src/pluginplay/printing/mermaid.cpp | 30 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 include/pluginplay/printing/mermaid.hpp create mode 100644 src/pluginplay/printing/mermaid.cpp diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp new file mode 100644 index 000000000..b35cb7fca --- /dev/null +++ b/include/pluginplay/printing/mermaid.hpp @@ -0,0 +1,19 @@ +/* + * Copyright 2023 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once +#include +#include diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp new file mode 100644 index 000000000..4e8c4a6f5 --- /dev/null +++ b/src/pluginplay/printing/mermaid.cpp @@ -0,0 +1,30 @@ +#include +#include "/home/jacob/Projects/PluginPlay/include/pluginplay/pluginplay.hpp" +#include "/home/jacob/Projects/GhostFragment/include/ghostfragment/ghostfragment.hpp" + +int main() { + pluginplay::ModuleManager mm; + ghostfragment::load_modules(mm); + + auto mm_keys = mm.keys(); + +// std::cout << "Keys: ["; +// for (size_t i = 0; i < mm_keys.size(); ++i) { +// std::cout << "\"" << mm_keys[i] << "\""; +// if (i < mm_keys.size() - 1) { +// std::cout << ", "; +// } +// } +// std::cout << "]" << std::endl; + + + auto mm_module = mm.at("Fragment Based Method"); + + auto mm_submods = mm_module.submods(); + + auto mm_first_submod = mm_submods[1]; // Not sure how to access + +// std::cout << mm_first_submod << std::endl; + + return 0; +} From ce04f9f11dc4f3aaa7cd0e4e2439c8fe6d48ef59 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 27 Dec 2024 12:50:04 -0600 Subject: [PATCH 02/59] Restart addition of mermaid graph, test with hello_world function --- include/pluginplay/printing/mermaid.hpp | 7 ++-- src/pluginplay/printing/mermaid.cpp | 32 +++--------------- src/pluginplay/printing/test | Bin 0 -> 19056 bytes .../pluginplay/printing/mermaid.cpp | 8 +++++ 4 files changed, 18 insertions(+), 29 deletions(-) create mode 100755 src/pluginplay/printing/test create mode 100644 tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index b35cb7fca..357727787 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -15,5 +15,8 @@ */ #pragma once -#include -#include +#include + +std::string hello_world(); + + diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 4e8c4a6f5..f6b178928 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -1,30 +1,8 @@ -#include -#include "/home/jacob/Projects/PluginPlay/include/pluginplay/pluginplay.hpp" -#include "/home/jacob/Projects/GhostFragment/include/ghostfragment/ghostfragment.hpp" +#include -int main() { - pluginplay::ModuleManager mm; - ghostfragment::load_modules(mm); +std::string hello_world() { + std::string hello = "Hello World!"; - auto mm_keys = mm.keys(); - -// std::cout << "Keys: ["; -// for (size_t i = 0; i < mm_keys.size(); ++i) { -// std::cout << "\"" << mm_keys[i] << "\""; -// if (i < mm_keys.size() - 1) { -// std::cout << ", "; -// } -// } -// std::cout << "]" << std::endl; - - - auto mm_module = mm.at("Fragment Based Method"); - - auto mm_submods = mm_module.submods(); - - auto mm_first_submod = mm_submods[1]; // Not sure how to access - -// std::cout << mm_first_submod << std::endl; - - return 0; + return hello; } + diff --git a/src/pluginplay/printing/test b/src/pluginplay/printing/test new file mode 100755 index 0000000000000000000000000000000000000000..8a4d147d4cb4a304a99028c1918deeed04701360 GIT binary patch literal 19056 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 SK&6=c?>8%s4GsYZD*hX&6!T*M literal 0 HcmV?d00001 diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp new file mode 100644 index 000000000..d57dd15c4 --- /dev/null +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -0,0 +1,8 @@ +#include +#include "mermaid.hpp" + +int main() { + std::string message = hello_world(); + std::cout << message << std::endl; + return 0; +} From d00bdb7bf9e79d2a74e2db5d6e43ee2b229f3544 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 27 Dec 2024 14:31:15 -0600 Subject: [PATCH 03/59] Trying to add tests for mermaid.cpp --- .../unit_tests/pluginplay/printing/mermaid.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index d57dd15c4..c0e6e9ade 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -1,8 +1,13 @@ #include -#include "mermaid.hpp" +#include "../catch.hpp" +#include "../test_common.hpp" +#include "pluginplay/printing/mermaid.hpp" -int main() { - std::string message = hello_world(); - std::cout << message << std::endl; - return 0; +using namespace testing; + +TEST_CASE("hello_world") { + SECTION("huh") { + auto hello = "Hello World!"; + REQUIRE(hello_world() == "Hello World!"); + } } From 72590261ef119ea4d5df6b11e0ac84afd5090c2b Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sat, 28 Dec 2024 22:04:40 -0600 Subject: [PATCH 04/59] just like me, ctest keeps failing --- src/pluginplay/printing/mermaid.cpp | 5 ++--- src/pluginplay/printing/test | Bin 19056 -> 0 bytes .../unit_tests/pluginplay/printing/mermaid.cpp | 9 +++------ 3 files changed, 5 insertions(+), 9 deletions(-) delete mode 100755 src/pluginplay/printing/test diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index f6b178928..2dd2d0b99 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -1,8 +1,7 @@ #include +#include "../../../include/pluginplay/printing/mermaid.hpp" std::string hello_world() { - std::string hello = "Hello World!"; - - return hello; + return "Hello World!"; } diff --git a/src/pluginplay/printing/test b/src/pluginplay/printing/test deleted file mode 100755 index 8a4d147d4cb4a304a99028c1918deeed04701360..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19056 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 SK&6=c?>8%s4GsYZD*hX&6!T*M diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index c0e6e9ade..e2c3912f7 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -1,13 +1,10 @@ -#include #include "../catch.hpp" #include "../test_common.hpp" -#include "pluginplay/printing/mermaid.hpp" - -using namespace testing; +#include "../../../../../include/pluginplay/printing/mermaid.hpp" TEST_CASE("hello_world") { SECTION("huh") { - auto hello = "Hello World!"; - REQUIRE(hello_world() == "Hello World!"); + auto hello = hello_world(); + REQUIRE(hello == "Hello World!"); } } From 0d6659fdef095bd4977ef25f4239c671005a1d29 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 29 Dec 2024 04:07:15 +0000 Subject: [PATCH 05/59] Committing clang-format changes --- include/pluginplay/printing/mermaid.hpp | 2 -- src/pluginplay/printing/mermaid.cpp | 23 +++++++++++++++---- .../pluginplay/printing/mermaid.cpp | 18 ++++++++++++++- 3 files changed, 35 insertions(+), 8 deletions(-) diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index 357727787..f05faba93 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -18,5 +18,3 @@ #include std::string hello_world(); - - diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 2dd2d0b99..06e712cf3 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -1,7 +1,20 @@ -#include -#include "../../../include/pluginplay/printing/mermaid.hpp" +/* + * Copyright 2024 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ -std::string hello_world() { - return "Hello World!"; -} +#include "../../../include/pluginplay/printing/mermaid.hpp" +#include +std::string hello_world() { return "Hello World!"; } diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index e2c3912f7..df3dc4707 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -1,6 +1,22 @@ +/* + * Copyright 2024 NWChemEx-Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "../../../../../include/pluginplay/printing/mermaid.hpp" #include "../catch.hpp" #include "../test_common.hpp" -#include "../../../../../include/pluginplay/printing/mermaid.hpp" TEST_CASE("hello_world") { SECTION("huh") { From 203a8c835fb6455a0210cd6bb5b9ee07a4973a49 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Sun, 29 Dec 2024 10:16:30 -0600 Subject: [PATCH 06/59] Update mermaid.cpp --- src/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 06e712cf3..b050de850 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "../../../include/pluginplay/printing/mermaid.hpp" +#include #include std::string hello_world() { return "Hello World!"; } From b08bf9896ade401de7a6e88ef6493cc5f3fbc0bd Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Sun, 29 Dec 2024 10:17:22 -0600 Subject: [PATCH 07/59] Update mermaid.cpp --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index df3dc4707..91ac4d336 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "../../../../../include/pluginplay/printing/mermaid.hpp" +#include #include "../catch.hpp" #include "../test_common.hpp" From 6e720d1252feacc3cf706bae2854edbbafc8c783 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 29 Dec 2024 16:18:18 +0000 Subject: [PATCH 08/59] Committing clang-format changes --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 91ac4d336..115493253 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -14,9 +14,9 @@ * limitations under the License. */ -#include #include "../catch.hpp" #include "../test_common.hpp" +#include TEST_CASE("hello_world") { SECTION("huh") { From 09fb82904500a4c5b4bcc2b6d4a1bdf23d902e09 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 9 Jan 2025 12:21:32 -0600 Subject: [PATCH 09/59] Finally actually doing some code --- .gitignore | 1 + include/pluginplay/printing/mermaid.hpp | 3 ++- src/pluginplay/printing/mermaid.cpp | 10 ++++++++-- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 10 +++++++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 6478ba293..75768e146 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ # These are directories used by IDEs for storing settings .idea/ .vscode/ +.cache # These are common Python virtual enviornment directory names venv/ diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index f05faba93..2dc0dda13 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -15,6 +15,7 @@ */ #pragma once +#include "module_manager/module_manager_class.hpp" #include -std::string hello_world(); +std::string hello_world(const pluginplay::ModuleManager& mm); diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index b050de850..1261080bd 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -14,7 +14,13 @@ * limitations under the License. */ +#include "module_manager/module_manager_class.hpp" #include -#include +#include -std::string hello_world() { return "Hello World!"; } +std::string hello_world(const pluginplay::ModuleManager& mm) { + for (int i = 0; i < mm.size(); i++) { + std::cout << "There are at least some modules in here" << std::endl; + } + return "Hello World!"; +} diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 115493253..80d3daebf 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,11 +16,19 @@ #include "../catch.hpp" #include "../test_common.hpp" +#include "module_manager/module_manager_class.hpp" #include +#include + TEST_CASE("hello_world") { + pluginplay::ModuleManager mm; + SECTION("huh") { - auto hello = hello_world(); + using mod_t = testing::NoPTModule; + mm.add_module("A mod"); + auto hello = hello_world(mm); + std::cout << "Bro the test ran but idk if the internals ran" << std::endl; REQUIRE(hello == "Hello World!"); } } From 4a419c9a81dad68b73cbe66200b8de90f2015179 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 9 Jan 2025 18:22:33 +0000 Subject: [PATCH 10/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 10 +++++----- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 1261080bd..c75657b5f 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -15,12 +15,12 @@ */ #include "module_manager/module_manager_class.hpp" -#include #include +#include std::string hello_world(const pluginplay::ModuleManager& mm) { - for (int i = 0; i < mm.size(); i++) { - std::cout << "There are at least some modules in here" << std::endl; - } - return "Hello World!"; + for(int i = 0; i < mm.size(); i++) { + std::cout << "There are at least some modules in here" << std::endl; + } + return "Hello World!"; } diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 80d3daebf..7aa67a2c0 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -17,9 +17,8 @@ #include "../catch.hpp" #include "../test_common.hpp" #include "module_manager/module_manager_class.hpp" -#include #include - +#include TEST_CASE("hello_world") { pluginplay::ModuleManager mm; @@ -28,7 +27,8 @@ TEST_CASE("hello_world") { using mod_t = testing::NoPTModule; mm.add_module("A mod"); auto hello = hello_world(mm); - std::cout << "Bro the test ran but idk if the internals ran" << std::endl; + std::cout << "Bro the test ran but idk if the internals ran" + << std::endl; REQUIRE(hello == "Hello World!"); } } From 372538f464063f091ed35f51ecada56daf765804 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 9 Jan 2025 13:15:50 -0600 Subject: [PATCH 11/59] Made suggested changes regarding mermaid.cpp, mermaid.hpp and the test code mermaid.cpp --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 7aa67a2c0..ead394d62 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,7 +16,6 @@ #include "../catch.hpp" #include "../test_common.hpp" -#include "module_manager/module_manager_class.hpp" #include #include From ee6fdd4baf65103412148292089bc02033a70065 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 9 Jan 2025 13:22:55 -0600 Subject: [PATCH 12/59] Made changes with usage of decltype --- include/pluginplay/printing/mermaid.hpp | 2 +- src/pluginplay/printing/mermaid.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index 2dc0dda13..4472f1267 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -15,7 +15,7 @@ */ #pragma once -#include "module_manager/module_manager_class.hpp" +#include #include std::string hello_world(const pluginplay::ModuleManager& mm); diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index c75657b5f..f3e366256 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -14,12 +14,11 @@ * limitations under the License. */ -#include "module_manager/module_manager_class.hpp" #include -#include std::string hello_world(const pluginplay::ModuleManager& mm) { - for(int i = 0; i < mm.size(); i++) { + auto n_modules = mm.size(); + for(decltype(n_modules) i = 0; i < n_modules; i++) { std::cout << "There are at least some modules in here" << std::endl; } return "Hello World!"; From f61012b1bf8cf4736c627a2fa87ba8931534de06 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 10 Jan 2025 16:11:31 -0600 Subject: [PATCH 13/59] Preparing to add module with several nested modules --- src/pluginplay/printing/mermaid.cpp | 7 ++++- .../pluginplay/printing/mermaid.cpp | 27 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index f3e366256..977acdc8b 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,7 +19,12 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { - std::cout << "There are at least some modules in here" << std::endl; + auto mod = mm.keys()[i]; + auto module = mm.at(mod); + std::cout << mod << std::endl; + auto submods = module.submods(); + for (const auto& [key, value] : submods) + std::cout << "This is a submod: " << key << std::endl; } return "Hello World!"; } diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index ead394d62..a4251d46e 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,15 +16,40 @@ #include "../catch.hpp" #include "../test_common.hpp" +#include "module/macros.hpp" +#include "unit_testing_pts.hpp" #include #include +DECLARE_MODULE(SubModLvl10); +inline MODULE_CTOR(SubModLvl10) { + satisfies_property_type(); + add_submodule("Submod 10"); +} + +DECLARE_MODULE(SubModLvl9); +inline MODULE_CTOR(SubModLvl9) { + satisfies_property_type(); + add_submodule("Submod 9"); +} + + +DECLARE_MODULE(TooManySubmods); +inline MODULE_CTOR(TooManySubmods) { + satisfies_property_type(); + + +} + TEST_CASE("hello_world") { pluginplay::ModuleManager mm; - + SECTION("huh") { using mod_t = testing::NoPTModule; mm.add_module("A mod"); + using mod_s = testing::SubModModule; + mm.add_module("SubModModule"); + auto hello = hello_world(mm); std::cout << "Bro the test ran but idk if the internals ran" << std::endl; From 29fe47ece386d56ab0c0b50daab0e154b94187a8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 10 Jan 2025 22:12:37 +0000 Subject: [PATCH 14/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 4 ++-- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 977acdc8b..c84b0e39f 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,11 +19,11 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; auto module = mm.at(mod); std::cout << mod << std::endl; auto submods = module.submods(); - for (const auto& [key, value] : submods) + for(const auto& [key, value] : submods) std::cout << "This is a submod: " << key << std::endl; } return "Hello World!"; diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index a4251d46e..debc6d97e 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -33,23 +33,20 @@ inline MODULE_CTOR(SubModLvl9) { add_submodule("Submod 9"); } - DECLARE_MODULE(TooManySubmods); inline MODULE_CTOR(TooManySubmods) { satisfies_property_type(); - - } TEST_CASE("hello_world") { pluginplay::ModuleManager mm; - + SECTION("huh") { using mod_t = testing::NoPTModule; mm.add_module("A mod"); using mod_s = testing::SubModModule; mm.add_module("SubModModule"); - + auto hello = hello_world(mm); std::cout << "Bro the test ran but idk if the internals ran" << std::endl; From 98746b21a8eaf356d6fe11812e0d4ceea4fe4eb6 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Tue, 14 Jan 2025 15:30:11 -0600 Subject: [PATCH 15/59] loaded test modules into mm --- .../pluginplay/printing/mermaid.cpp | 49 +++++++++++++------ 1 file changed, 35 insertions(+), 14 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index debc6d97e..d10f73696 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -20,32 +20,53 @@ #include "unit_testing_pts.hpp" #include #include +#include -DECLARE_MODULE(SubModLvl10); -inline MODULE_CTOR(SubModLvl10) { - satisfies_property_type(); - add_submodule("Submod 10"); -} +#define DECLARE_TEST_MODULE(number) \ +DECLARE_MODULE(SubmodLvl ## number); \ +inline MODULE_CTOR(SubmodLvl ## number) { \ + satisfies_property_type(); \ + add_submodule("Submod " #number); \ +} \ +inline MODULE_RUN(SubmodLvl ## number) { return results(); } -DECLARE_MODULE(SubModLvl9); -inline MODULE_CTOR(SubModLvl9) { - satisfies_property_type(); - add_submodule("Submod 9"); -} +DECLARE_TEST_MODULE(10) +DECLARE_TEST_MODULE(9) +DECLARE_TEST_MODULE(8) +DECLARE_TEST_MODULE(7) +DECLARE_TEST_MODULE(6) +DECLARE_TEST_MODULE(5) +DECLARE_TEST_MODULE(4) +DECLARE_TEST_MODULE(3) +DECLARE_TEST_MODULE(2) +DECLARE_TEST_MODULE(1) + +#undef DECLARE_TEST_MODULE DECLARE_MODULE(TooManySubmods); inline MODULE_CTOR(TooManySubmods) { satisfies_property_type(); + add_submodule("Submods"); } +inline MODULE_RUN(TooManySubmods) {return results();} TEST_CASE("hello_world") { pluginplay::ModuleManager mm; + mm.add_module("SubmodLvl10"); + mm.add_module("SubmodLvl9"); + mm.add_module("SubmodLvl8"); + mm.add_module("SubmodLvl7"); + mm.add_module("SubmodLvl6"); + mm.add_module("SubmodLvl5"); + mm.add_module("SubmodLvl4"); + mm.add_module("SubmodLvl3"); + mm.add_module("SubmodLvl2"); + mm.add_module("SubmodLvl1"); SECTION("huh") { - using mod_t = testing::NoPTModule; - mm.add_module("A mod"); - using mod_s = testing::SubModModule; - mm.add_module("SubModModule"); + mm.add_module("TooManySubmods"); + mm.add_module("SubmodLvl1"); + mm.change_submod("TooManySubmods", "Submods", "SubmodLvl10"); auto hello = hello_world(mm); std::cout << "Bro the test ran but idk if the internals ran" From c4ad8ddccee158bb306c5381cb8cfae73fcc197c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 14 Jan 2025 21:31:13 +0000 Subject: [PATCH 16/59] Committing clang-format changes --- .../unit_tests/pluginplay/printing/mermaid.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index d10f73696..4c68ad444 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -22,13 +22,13 @@ #include #include -#define DECLARE_TEST_MODULE(number) \ -DECLARE_MODULE(SubmodLvl ## number); \ -inline MODULE_CTOR(SubmodLvl ## number) { \ - satisfies_property_type(); \ - add_submodule("Submod " #number); \ -} \ -inline MODULE_RUN(SubmodLvl ## number) { return results(); } +#define DECLARE_TEST_MODULE(number) \ + DECLARE_MODULE(SubmodLvl##number); \ + inline MODULE_CTOR(SubmodLvl##number) { \ + satisfies_property_type(); \ + add_submodule("Submod " #number); \ + } \ + inline MODULE_RUN(SubmodLvl##number) { return results(); } DECLARE_TEST_MODULE(10) DECLARE_TEST_MODULE(9) @@ -48,7 +48,7 @@ inline MODULE_CTOR(TooManySubmods) { satisfies_property_type(); add_submodule("Submods"); } -inline MODULE_RUN(TooManySubmods) {return results();} +inline MODULE_RUN(TooManySubmods) { return results(); } TEST_CASE("hello_world") { pluginplay::ModuleManager mm; From 0177e4f49b7a95636d888b252c9c3133dbc6e060 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Tue, 14 Jan 2025 15:37:40 -0600 Subject: [PATCH 17/59] adjusted code to work since it didn't in the previous commit --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 4c68ad444..819a9301b 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -20,7 +20,6 @@ #include "unit_testing_pts.hpp" #include #include -#include #define DECLARE_TEST_MODULE(number) \ DECLARE_MODULE(SubmodLvl##number); \ @@ -65,7 +64,6 @@ TEST_CASE("hello_world") { mm.add_module("SubmodLvl1"); SECTION("huh") { mm.add_module("TooManySubmods"); - mm.add_module("SubmodLvl1"); mm.change_submod("TooManySubmods", "Submods", "SubmodLvl10"); auto hello = hello_world(mm); From ff92d0c30a0920875744207974ef092d81e77274 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 16 Jan 2025 07:54:03 -0600 Subject: [PATCH 18/59] Lego'd the modules, compiled normally? --- .../pluginplay/printing/mermaid.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 819a9301b..e60b60fab 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -28,6 +28,8 @@ add_submodule("Submod " #number); \ } \ inline MODULE_RUN(SubmodLvl##number) { return results(); } +// Module Name: SubmodLvl# +// Submodule Name: Submod # DECLARE_TEST_MODULE(10) DECLARE_TEST_MODULE(9) @@ -51,7 +53,7 @@ inline MODULE_RUN(TooManySubmods) { return results(); } TEST_CASE("hello_world") { pluginplay::ModuleManager mm; - + // Load in Modules mm.add_module("SubmodLvl10"); mm.add_module("SubmodLvl9"); mm.add_module("SubmodLvl8"); @@ -62,10 +64,19 @@ TEST_CASE("hello_world") { mm.add_module("SubmodLvl3"); mm.add_module("SubmodLvl2"); mm.add_module("SubmodLvl1"); - SECTION("huh") { - mm.add_module("TooManySubmods"); - mm.change_submod("TooManySubmods", "Submods", "SubmodLvl10"); + mm.add_module("TooManySubmods"); + mm.change_submod("TooManySubmods", "Submods", "SubmodLvl1"); + mm.change_submod("SubmodLvl1", "Submod 1", "SubmodLvl2"); + mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); + mm.change_submod("SubmodLvl3", "Submod 3", "SubmodLvl4"); + mm.change_submod("SubmodLvl4", "Submod 4", "SubmodLvl5"); + mm.change_submod("SubmodLvl5", "Submod 5", "SubmodLvl6"); + mm.change_submod("SubmodLvl6", "Submod 6", "SubmodLvl7"); + mm.change_submod("SubmodLvl7", "Submod 7", "SubmodLvl8"); + mm.change_submod("SubmodLvl8", "Submod 8", "SubmodLvl9"); + mm.change_submod("SubmodLvl9", "Submod 9", "SubmodLvl10"); + SECTION("huh") { auto hello = hello_world(mm); std::cout << "Bro the test ran but idk if the internals ran" << std::endl; From a06ae221e8df126b6dce6c40b0479b3a15f3f21f Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 16 Jan 2025 09:31:53 -0600 Subject: [PATCH 19/59] added some debug printout --- src/pluginplay/printing/mermaid.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index c84b0e39f..1a354520b 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -17,14 +17,28 @@ #include std::string hello_world(const pluginplay::ModuleManager& mm) { + std::cout << "RUNNING IN THE SOURCE" << std::endl; + std::cout << "ASSIGNING mm.size() TO n_modules" << std::endl; auto n_modules = mm.size(); + std::cout << "RUNNING FOR LOOP 1" << std::endl; for(decltype(n_modules) i = 0; i < n_modules; i++) { + std::cout << "ASSIGNING m.keys()[i] TO mod" << std::endl; auto mod = mm.keys()[i]; + std::cout << "ASSIGNING mm.at(mod) TO module" << std::endl; auto module = mm.at(mod); + std::cout << "PRINTING mod" << std::endl; std::cout << mod << std::endl; + std::cout << "ASSIGNING module.submods() TO submods" << std::endl; auto submods = module.submods(); - for(const auto& [key, value] : submods) - std::cout << "This is a submod: " << key << std::endl; + std::cout << "RUNNING FOR LOOP 2" << std::endl; + for(const auto& [key, value] : submods) { + std::cout << "PRINTING key IN submods" << std::endl; + std::cout << "This is a submod identifier: " << key << std::endl; + std::cout << "ASSIGNING mm.at(key).get_name() TO submod_name" << std::endl; + auto submod_name = mm.at(key).get_name(); + std::cout << "PRINTING submod_name" << std::endl; + std::cout << "This is the true name: " << submod_name << std::endl; + } } return "Hello World!"; } From fca1de629a77ded2a91678892b71ab1358fc881d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 16 Jan 2025 15:32:55 +0000 Subject: [PATCH 20/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 1a354520b..57f5b6c05 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -23,7 +23,7 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { std::cout << "RUNNING FOR LOOP 1" << std::endl; for(decltype(n_modules) i = 0; i < n_modules; i++) { std::cout << "ASSIGNING m.keys()[i] TO mod" << std::endl; - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; std::cout << "ASSIGNING mm.at(mod) TO module" << std::endl; auto module = mm.at(mod); std::cout << "PRINTING mod" << std::endl; @@ -34,7 +34,8 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { for(const auto& [key, value] : submods) { std::cout << "PRINTING key IN submods" << std::endl; std::cout << "This is a submod identifier: " << key << std::endl; - std::cout << "ASSIGNING mm.at(key).get_name() TO submod_name" << std::endl; + std::cout << "ASSIGNING mm.at(key).get_name() TO submod_name" + << std::endl; auto submod_name = mm.at(key).get_name(); std::cout << "PRINTING submod_name" << std::endl; std::cout << "This is the true name: " << submod_name << std::endl; From af6a5316f516a4458300f04f7a5e2d53a3142ce7 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 10:52:08 -0600 Subject: [PATCH 21/59] Added submodule printing function, adjusted module creation --- src/pluginplay/printing/mermaid.cpp | 47 +++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 57f5b6c05..67b64b3ed 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -14,8 +14,11 @@ * limitations under the License. */ +#include "module/module_class.hpp" +#include "module_manager/module_manager_class.hpp" #include +<<<<<<< HEAD std::string hello_world(const pluginplay::ModuleManager& mm) { std::cout << "RUNNING IN THE SOURCE" << std::endl; std::cout << "ASSIGNING mm.size() TO n_modules" << std::endl; @@ -39,7 +42,51 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { auto submod_name = mm.at(key).get_name(); std::cout << "PRINTING submod_name" << std::endl; std::cout << "This is the true name: " << submod_name << std::endl; +======= +void print_submods(const pluginplay::Module& module, int level = 0) { + for (int i = 0; i < level; ++i) { + std::cout << " "; + } + auto submods = module.submods(); + + for (const auto& [key, value] : submods) { + if (value.ready() == false) { + continue; +>>>>>>> 76e1bf2d (Added submodule printing function, adjusted module creation) + } + auto submod_name = value.get_name(); + std::cout << "Submod Name: " << submod_name << std::endl; + + pluginplay::ModuleManager mm; + + for (const auto& [key, submod] : mm.at(submod_name).submods()){ + print_submods(submod, level + 1); } } +} + +std::string hello_world(const pluginplay::ModuleManager& mm) { + + auto n_modules = mm.size(); + for(decltype(n_modules) i = 0; i < n_modules; i++) { + auto mod = mm.keys()[i]; + auto module = mm.at(mod); + + print_submods(module); + + // std::cout << mod << std::endl; + + // auto submods = module.submods(); + + // for(const auto& [key, value] : submods) { + // std::cout << "This is a submod identifier: " << key << std::endl; + + // auto submod_name = value.get_name(); + + // std::cout << "This is the true name: " << submod_name << std::endl; + + // auto mm_submod = mm.at(submod_name); + //} + } return "Hello World!"; } From 953195f87c6d60ce74a22d1ae833830073df8453 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 10:51:01 -0600 Subject: [PATCH 22/59] Added submodule printing function, adjusted module creation --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index e60b60fab..e17f8ee6e 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -31,7 +31,6 @@ // Module Name: SubmodLvl# // Submodule Name: Submod # -DECLARE_TEST_MODULE(10) DECLARE_TEST_MODULE(9) DECLARE_TEST_MODULE(8) DECLARE_TEST_MODULE(7) @@ -50,11 +49,11 @@ inline MODULE_CTOR(TooManySubmods) { add_submodule("Submods"); } inline MODULE_RUN(TooManySubmods) { return results(); } +// Make it to where the modules branch TEST_CASE("hello_world") { pluginplay::ModuleManager mm; // Load in Modules - mm.add_module("SubmodLvl10"); mm.add_module("SubmodLvl9"); mm.add_module("SubmodLvl8"); mm.add_module("SubmodLvl7"); @@ -74,7 +73,6 @@ TEST_CASE("hello_world") { mm.change_submod("SubmodLvl6", "Submod 6", "SubmodLvl7"); mm.change_submod("SubmodLvl7", "Submod 7", "SubmodLvl8"); mm.change_submod("SubmodLvl8", "Submod 8", "SubmodLvl9"); - mm.change_submod("SubmodLvl9", "Submod 9", "SubmodLvl10"); SECTION("huh") { auto hello = hello_world(mm); From 40d249e54dfc25d8d52801eb1c3d523dfe970efd Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 10:56:44 -0600 Subject: [PATCH 23/59] In git commit purgatory, making sure I didn't kill anything --- src/pluginplay/printing/mermaid.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 67b64b3ed..b06245ff5 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -18,31 +18,6 @@ #include "module_manager/module_manager_class.hpp" #include -<<<<<<< HEAD -std::string hello_world(const pluginplay::ModuleManager& mm) { - std::cout << "RUNNING IN THE SOURCE" << std::endl; - std::cout << "ASSIGNING mm.size() TO n_modules" << std::endl; - auto n_modules = mm.size(); - std::cout << "RUNNING FOR LOOP 1" << std::endl; - for(decltype(n_modules) i = 0; i < n_modules; i++) { - std::cout << "ASSIGNING m.keys()[i] TO mod" << std::endl; - auto mod = mm.keys()[i]; - std::cout << "ASSIGNING mm.at(mod) TO module" << std::endl; - auto module = mm.at(mod); - std::cout << "PRINTING mod" << std::endl; - std::cout << mod << std::endl; - std::cout << "ASSIGNING module.submods() TO submods" << std::endl; - auto submods = module.submods(); - std::cout << "RUNNING FOR LOOP 2" << std::endl; - for(const auto& [key, value] : submods) { - std::cout << "PRINTING key IN submods" << std::endl; - std::cout << "This is a submod identifier: " << key << std::endl; - std::cout << "ASSIGNING mm.at(key).get_name() TO submod_name" - << std::endl; - auto submod_name = mm.at(key).get_name(); - std::cout << "PRINTING submod_name" << std::endl; - std::cout << "This is the true name: " << submod_name << std::endl; -======= void print_submods(const pluginplay::Module& module, int level = 0) { for (int i = 0; i < level; ++i) { std::cout << " "; @@ -52,7 +27,6 @@ void print_submods(const pluginplay::Module& module, int level = 0) { for (const auto& [key, value] : submods) { if (value.ready() == false) { continue; ->>>>>>> 76e1bf2d (Added submodule printing function, adjusted module creation) } auto submod_name = value.get_name(); std::cout << "Submod Name: " << submod_name << std::endl; From 5125681a097680943fb7250bea561dbaa50a74ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Jan 2025 16:57:44 +0000 Subject: [PATCH 24/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index b06245ff5..761776200 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,28 +19,23 @@ #include void print_submods(const pluginplay::Module& module, int level = 0) { - for (int i = 0; i < level; ++i) { - std::cout << " "; - } + for(int i = 0; i < level; ++i) { std::cout << " "; } auto submods = module.submods(); - for (const auto& [key, value] : submods) { - if (value.ready() == false) { - continue; - } + for(const auto& [key, value] : submods) { + if(value.ready() == false) { continue; } auto submod_name = value.get_name(); std::cout << "Submod Name: " << submod_name << std::endl; pluginplay::ModuleManager mm; - for (const auto& [key, submod] : mm.at(submod_name).submods()){ + for(const auto& [key, submod] : mm.at(submod_name).submods()) { print_submods(submod, level + 1); } } } std::string hello_world(const pluginplay::ModuleManager& mm) { - auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; @@ -57,7 +52,8 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { // auto submod_name = value.get_name(); - // std::cout << "This is the true name: " << submod_name << std::endl; + // std::cout << "This is the true name: " << submod_name << + // std::endl; // auto mm_submod = mm.at(submod_name); //} From 8c9a575d6e636b8054c78693621057343e6a6736 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 11:18:25 -0600 Subject: [PATCH 25/59] Really close now --- src/pluginplay/printing/mermaid.cpp | 47 +++++++++++------------------ 1 file changed, 17 insertions(+), 30 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 761776200..8dcc5e868 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -18,45 +18,32 @@ #include "module_manager/module_manager_class.hpp" #include -void print_submods(const pluginplay::Module& module, int level = 0) { - for(int i = 0; i < level; ++i) { std::cout << " "; } - auto submods = module.submods(); - - for(const auto& [key, value] : submods) { - if(value.ready() == false) { continue; } - auto submod_name = value.get_name(); - std::cout << "Submod Name: " << submod_name << std::endl; +void print_submods(const std::string module, int level = 0) { + for (int i = 0; i < level; ++i) { + std::cout << " "; + } + pluginplay::ModuleManager mm; + auto mm_module = mm.at(module); + auto submods = mm_module.submods(); - pluginplay::ModuleManager mm; + for (const auto& [key, value] : submods) { + if (value.ready() == false) { + continue; + } + std::cout << "Submod ID: "<< key << std::endl; + std::cout << "Submod Name: " << value.get_name() << std::endl; - for(const auto& [key, submod] : mm.at(submod_name).submods()) { - print_submods(submod, level + 1); + std::string submod_name = value.get_name(); + + print_submods(submod_name, level + 1); } - } } std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - auto module = mm.at(mod); - - print_submods(module); - - // std::cout << mod << std::endl; - - // auto submods = module.submods(); - - // for(const auto& [key, value] : submods) { - // std::cout << "This is a submod identifier: " << key << std::endl; - - // auto submod_name = value.get_name(); - - // std::cout << "This is the true name: " << submod_name << - // std::endl; - - // auto mm_submod = mm.at(submod_name); - //} + print_submods(mod); } return "Hello World!"; } From 8afb7a8224524104600d2329b454b857134852e5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Jan 2025 17:24:49 +0000 Subject: [PATCH 26/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 8dcc5e868..2a1c7dc02 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,30 +19,26 @@ #include void print_submods(const std::string module, int level = 0) { - for (int i = 0; i < level; ++i) { - std::cout << " "; - } + for(int i = 0; i < level; ++i) { std::cout << " "; } pluginplay::ModuleManager mm; auto mm_module = mm.at(module); - auto submods = mm_module.submods(); + auto submods = mm_module.submods(); - for (const auto& [key, value] : submods) { - if (value.ready() == false) { - continue; - } - std::cout << "Submod ID: "<< key << std::endl; + for(const auto& [key, value] : submods) { + if(value.ready() == false) { continue; } + std::cout << "Submod ID: " << key << std::endl; std::cout << "Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); - + print_submods(submod_name, level + 1); - } + } } std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; print_submods(mod); } return "Hello World!"; From 015c5afde60300ac62bfa35f2a456d2a1f92d782 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 14:22:02 -0600 Subject: [PATCH 27/59] I am really hating these clang-formats --- src/pluginplay/printing/mermaid.cpp | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 2a1c7dc02..ba7de9596 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -18,28 +18,33 @@ #include "module_manager/module_manager_class.hpp" #include -void print_submods(const std::string module, int level = 0) { - for(int i = 0; i < level; ++i) { std::cout << " "; } - pluginplay::ModuleManager mm; +void print_submods(const std::string module, const pluginplay::ModuleManager& mm, int level = 0) { + for (int i = 0; i < level; ++i) { + std::cout << " "; + } auto mm_module = mm.at(module); auto submods = mm_module.submods(); - for(const auto& [key, value] : submods) { - if(value.ready() == false) { continue; } - std::cout << "Submod ID: " << key << std::endl; + std::cout << "STARTING FOR LOOP ON SUBMODS" << std::endl; + for (const auto& [key, value] : submods) { + if (value.ready() == false) { + continue; + } + std::cout << "Submod ID: "<< key << std::endl; std::cout << "Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); - - print_submods(submod_name, level + 1); - } + + print_submods(submod_name, mm, level + 1); + } } std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { - auto mod = mm.keys()[i]; - print_submods(mod); + auto mod = mm.keys()[i]; + std::cout << "RUNNING PRINT_SUBMODS in hello_world" << std::endl; + print_submods(mod, mm); } return "Hello World!"; } From 7e07b3bd07e402089c5dbfd38d742e9e34d53cbc Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 23 Jan 2025 20:23:24 +0000 Subject: [PATCH 28/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index ba7de9596..fab8d559c 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -18,31 +18,28 @@ #include "module_manager/module_manager_class.hpp" #include -void print_submods(const std::string module, const pluginplay::ModuleManager& mm, int level = 0) { - for (int i = 0; i < level; ++i) { - std::cout << " "; - } +void print_submods(const std::string module, + const pluginplay::ModuleManager& mm, int level = 0) { + for(int i = 0; i < level; ++i) { std::cout << " "; } auto mm_module = mm.at(module); auto submods = mm_module.submods(); std::cout << "STARTING FOR LOOP ON SUBMODS" << std::endl; - for (const auto& [key, value] : submods) { - if (value.ready() == false) { - continue; - } - std::cout << "Submod ID: "<< key << std::endl; + for(const auto& [key, value] : submods) { + if(value.ready() == false) { continue; } + std::cout << "Submod ID: " << key << std::endl; std::cout << "Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); - - print_submods(submod_name, mm, level + 1); - } + + print_submods(submod_name, mm, level + 1); + } } std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; std::cout << "RUNNING PRINT_SUBMODS in hello_world" << std::endl; print_submods(mod, mm); } From 5e5a879afb45a91c152a62e1ac15289001072a40 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 22:27:33 -0600 Subject: [PATCH 29/59] Learned how to deal with missing submodules --- src/pluginplay/printing/mermaid.cpp | 3 +-- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index fab8d559c..faf31c910 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -20,14 +20,13 @@ void print_submods(const std::string module, const pluginplay::ModuleManager& mm, int level = 0) { - for(int i = 0; i < level; ++i) { std::cout << " "; } auto mm_module = mm.at(module); auto submods = mm_module.submods(); std::cout << "STARTING FOR LOOP ON SUBMODS" << std::endl; for(const auto& [key, value] : submods) { - if(value.ready() == false) { continue; } std::cout << "Submod ID: " << key << std::endl; + if (value.has_module() == false) { std::cout << "No Submodule associated with Key yet" << std::endl; continue;} std::cout << "Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index e17f8ee6e..923a17c16 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -73,6 +73,7 @@ TEST_CASE("hello_world") { mm.change_submod("SubmodLvl6", "Submod 6", "SubmodLvl7"); mm.change_submod("SubmodLvl7", "Submod 7", "SubmodLvl8"); mm.change_submod("SubmodLvl8", "Submod 8", "SubmodLvl9"); + //mm.change_submod("SubmodLvl9", "Submod 9", "TooManySubmods"); SECTION("huh") { auto hello = hello_world(mm); From 6a21485382b1a2ae76670d6f89edc13cb2e4e4fa Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 24 Jan 2025 04:29:00 +0000 Subject: [PATCH 30/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 5 ++++- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index faf31c910..507bfd9b9 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -26,7 +26,10 @@ void print_submods(const std::string module, std::cout << "STARTING FOR LOOP ON SUBMODS" << std::endl; for(const auto& [key, value] : submods) { std::cout << "Submod ID: " << key << std::endl; - if (value.has_module() == false) { std::cout << "No Submodule associated with Key yet" << std::endl; continue;} + if(value.has_module() == false) { + std::cout << "No Submodule associated with Key yet" << std::endl; + continue; + } std::cout << "Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 923a17c16..7d23180ed 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -73,7 +73,7 @@ TEST_CASE("hello_world") { mm.change_submod("SubmodLvl6", "Submod 6", "SubmodLvl7"); mm.change_submod("SubmodLvl7", "Submod 7", "SubmodLvl8"); mm.change_submod("SubmodLvl8", "Submod 8", "SubmodLvl9"); - //mm.change_submod("SubmodLvl9", "Submod 9", "TooManySubmods"); + // mm.change_submod("SubmodLvl9", "Submod 9", "TooManySubmods"); SECTION("huh") { auto hello = hello_world(mm); From 7eac1b7eb4bac932b1f18cf451241b561c7d2c11 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 23 Jan 2025 22:52:58 -0600 Subject: [PATCH 31/59] removed some debugging statements and learned clang-format --- src/pluginplay/printing/mermaid.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 507bfd9b9..e7b3d360f 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -23,7 +23,6 @@ void print_submods(const std::string module, auto mm_module = mm.at(module); auto submods = mm_module.submods(); - std::cout << "STARTING FOR LOOP ON SUBMODS" << std::endl; for(const auto& [key, value] : submods) { std::cout << "Submod ID: " << key << std::endl; if(value.has_module() == false) { @@ -42,7 +41,6 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - std::cout << "RUNNING PRINT_SUBMODS in hello_world" << std::endl; print_submods(mod, mm); } return "Hello World!"; From 2d304688c0d539c25da01c5a73b26302bcc743f9 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 24 Jan 2025 15:15:17 -0600 Subject: [PATCH 32/59] reflowed the files a bit --- src/pluginplay/printing/mermaid.cpp | 30 ++++++++++++------- .../pluginplay/printing/mermaid.cpp | 19 ------------ 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index e7b3d360f..2ea49f9b3 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -17,31 +17,39 @@ #include "module/module_class.hpp" #include "module_manager/module_manager_class.hpp" #include +#include void print_submods(const std::string module, - const pluginplay::ModuleManager& mm, int level = 0) { - auto mm_module = mm.at(module); + const pluginplay::ModuleManager& mm, + std::stringstream& ss, int level = 0) { + const auto& mm_module = mm.at(module); auto submods = mm_module.submods(); + std::string indent(level * 4, '-'); for(const auto& [key, value] : submods) { - std::cout << "Submod ID: " << key << std::endl; + ss << indent << "1 Submod ID: " << key << std::endl; if(value.has_module() == false) { - std::cout << "No Submodule associated with Key yet" << std::endl; - continue; + ss << indent << "No Submodule associated with Key yet" << std::endl; + break; + } else { + ss << indent << "2 Submod Name: " << value.get_name() << std::endl; + std::string submod_name = value.get_name(); + print_submods(submod_name, mm, ss, level + 1); } - std::cout << "Submod Name: " << value.get_name() << std::endl; - - std::string submod_name = value.get_name(); - - print_submods(submod_name, mm, level + 1); } + std::cout << ss.str(); } std::string hello_world(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); + std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - print_submods(mod, mm); + std::string indent(i*4, '-'); + ss << indent; + ss << "Level: " << i << std::endl; + print_submods(mod, mm, ss); } + std::cout << ss.str(); return "Hello World!"; } diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 7d23180ed..67f9ddf63 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -31,12 +31,6 @@ // Module Name: SubmodLvl# // Submodule Name: Submod # -DECLARE_TEST_MODULE(9) -DECLARE_TEST_MODULE(8) -DECLARE_TEST_MODULE(7) -DECLARE_TEST_MODULE(6) -DECLARE_TEST_MODULE(5) -DECLARE_TEST_MODULE(4) DECLARE_TEST_MODULE(3) DECLARE_TEST_MODULE(2) DECLARE_TEST_MODULE(1) @@ -54,12 +48,6 @@ inline MODULE_RUN(TooManySubmods) { return results(); } TEST_CASE("hello_world") { pluginplay::ModuleManager mm; // Load in Modules - mm.add_module("SubmodLvl9"); - mm.add_module("SubmodLvl8"); - mm.add_module("SubmodLvl7"); - mm.add_module("SubmodLvl6"); - mm.add_module("SubmodLvl5"); - mm.add_module("SubmodLvl4"); mm.add_module("SubmodLvl3"); mm.add_module("SubmodLvl2"); mm.add_module("SubmodLvl1"); @@ -67,13 +55,6 @@ TEST_CASE("hello_world") { mm.change_submod("TooManySubmods", "Submods", "SubmodLvl1"); mm.change_submod("SubmodLvl1", "Submod 1", "SubmodLvl2"); mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); - mm.change_submod("SubmodLvl3", "Submod 3", "SubmodLvl4"); - mm.change_submod("SubmodLvl4", "Submod 4", "SubmodLvl5"); - mm.change_submod("SubmodLvl5", "Submod 5", "SubmodLvl6"); - mm.change_submod("SubmodLvl6", "Submod 6", "SubmodLvl7"); - mm.change_submod("SubmodLvl7", "Submod 7", "SubmodLvl8"); - mm.change_submod("SubmodLvl8", "Submod 8", "SubmodLvl9"); - // mm.change_submod("SubmodLvl9", "Submod 9", "TooManySubmods"); SECTION("huh") { auto hello = hello_world(mm); From 1a267592b9b4575386f7d018da4a3bfefab3cbb9 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 24 Jan 2025 15:16:14 -0600 Subject: [PATCH 33/59] commiting clang-format changes, by myself --- src/pluginplay/printing/mermaid.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 2ea49f9b3..28f51304e 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -20,16 +20,16 @@ #include void print_submods(const std::string module, - const pluginplay::ModuleManager& mm, - std::stringstream& ss, int level = 0) { + const pluginplay::ModuleManager& mm, std::stringstream& ss, + int level = 0) { const auto& mm_module = mm.at(module); - auto submods = mm_module.submods(); + auto submods = mm_module.submods(); std::string indent(level * 4, '-'); for(const auto& [key, value] : submods) { - ss << indent << "1 Submod ID: " << key << std::endl; + ss << indent << "1 Submod ID: " << key << std::endl; if(value.has_module() == false) { - ss << indent << "No Submodule associated with Key yet" << std::endl; + ss << indent << "No Submodule associated with Key yet" << std::endl; break; } else { ss << indent << "2 Submod Name: " << value.get_name() << std::endl; @@ -45,7 +45,7 @@ std::string hello_world(const pluginplay::ModuleManager& mm) { std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - std::string indent(i*4, '-'); + std::string indent(i * 4, '-'); ss << indent; ss << "Level: " << i << std::endl; print_submods(mod, mm, ss); From ccb47bbfa9361ac5f2e6c78f906a38710affeee7 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sat, 25 Jan 2025 08:47:30 -0600 Subject: [PATCH 34/59] adding changes --- include/pluginplay/printing/mermaid.hpp | 2 +- src/pluginplay/printing/mermaid.cpp | 4 ++-- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index 4472f1267..7b98950f3 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -18,4 +18,4 @@ #include #include -std::string hello_world(const pluginplay::ModuleManager& mm); +std::string create_mermaid_graph(const pluginplay::ModuleManager& mm); diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 28f51304e..942c033bb 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -34,17 +34,17 @@ void print_submods(const std::string module, } else { ss << indent << "2 Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); - print_submods(submod_name, mm, ss, level + 1); } } std::cout << ss.str(); } -std::string hello_world(const pluginplay::ModuleManager& mm) { +std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; + std::cout << mod << std::endl; std::string indent(i * 4, '-'); ss << indent; ss << "Level: " << i << std::endl; diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 67f9ddf63..89cd87a67 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -57,7 +57,7 @@ TEST_CASE("hello_world") { mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); SECTION("huh") { - auto hello = hello_world(mm); + auto hello = create_mermaid_graph(mm); std::cout << "Bro the test ran but idk if the internals ran" << std::endl; REQUIRE(hello == "Hello World!"); From 2c295a733c62ce9f26aad8393b1102e77e30fdce Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sat, 25 Jan 2025 11:07:34 -0600 Subject: [PATCH 35/59] if my brain was a stringstream --- src/pluginplay/printing/mermaid.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 942c033bb..984ac6abb 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,24 +19,26 @@ #include #include -void print_submods(const std::string module, +void print_submods(const std::string module_key, const pluginplay::ModuleManager& mm, std::stringstream& ss, - int level = 0) { - const auto& mm_module = mm.at(module); - auto submods = mm_module.submods(); + int level) { + const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module + const auto& submods = mm_module.submods(); // Results in list of Submodules std::string indent(level * 4, '-'); + // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { ss << indent << "1 Submod ID: " << key << std::endl; if(value.has_module() == false) { - ss << indent << "No Submodule associated with Key yet" << std::endl; - break; + ss << indent + << "2 Submod Name: No Submodule associated with Key yet" + << std::endl; + continue; } else { ss << indent << "2 Submod Name: " << value.get_name() << std::endl; std::string submod_name = value.get_name(); } } - std::cout << ss.str(); } std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { @@ -48,7 +50,7 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { std::string indent(i * 4, '-'); ss << indent; ss << "Level: " << i << std::endl; - print_submods(mod, mm, ss); + print_submods(mod, mm, ss, i); } std::cout << ss.str(); return "Hello World!"; From 86a440de904196c26a35f2a99ab72283870a72f6 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sat, 25 Jan 2025 20:31:46 -0600 Subject: [PATCH 36/59] I have an indent in my head --- src/pluginplay/printing/mermaid.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 984ac6abb..191426767 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -24,19 +24,19 @@ void print_submods(const std::string module_key, int level) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - std::string indent(level * 4, '-'); + std::string indent((level + 1) * 4, '-'); // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << indent << "1 Submod ID: " << key << std::endl; + ss << indent << "Step 2: Submod ID: " << key << std::endl; if(value.has_module() == false) { ss << indent - << "2 Submod Name: No Submodule associated with Key yet" + << "Step 3: Submod Name: No Submodule associated with Key yet\n" << std::endl; continue; } else { - ss << indent << "2 Submod Name: " << value.get_name() << std::endl; - std::string submod_name = value.get_name(); + ss << indent << "Step 3: Submod Name: " << value.get_name() << "\n" + << std::endl; } } } @@ -46,10 +46,9 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - std::cout << mod << std::endl; + ss << "Step 1: " << mod << std::endl; std::string indent(i * 4, '-'); ss << indent; - ss << "Level: " << i << std::endl; print_submods(mod, mm, ss, i); } std::cout << ss.str(); From db6470dc3b386af96a67521a1b3a86822ae6ff0d Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sat, 25 Jan 2025 21:35:10 -0600 Subject: [PATCH 37/59] I am now a stringstream master (I only know ss.str()) --- src/pluginplay/printing/mermaid.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 191426767..350a7db89 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -24,18 +24,21 @@ void print_submods(const std::string module_key, int level) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - std::string indent((level + 1) * 4, '-'); + std::string indent_2((level + 1) * 4, '-'); + std::string indent_3((level + 1) * 4, '/'); // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << indent << "Step 2: Submod ID: " << key << std::endl; + ss << indent_2 << "Step 2: Submod ID: " << key + << std::endl; // Second indent: ---- if(value.has_module() == false) { - ss << indent + ss << indent_3 // Third indent ----- << "Step 3: Submod Name: No Submodule associated with Key yet\n" << std::endl; continue; } else { - ss << indent << "Step 3: Submod Name: " << value.get_name() << "\n" + ss << indent_3 << "Step 3: Submod Name: " << value.get_name() + << "\n" << std::endl; } } @@ -46,9 +49,9 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; + std::string indent_1(i * 4, '+'); + ss << indent_1; // First Indent: '' ss << "Step 1: " << mod << std::endl; - std::string indent(i * 4, '-'); - ss << indent; print_submods(mod, mm, ss, i); } std::cout << ss.str(); From cc0e2308e21844d8ba1c190b2762611f3ded1f85 Mon Sep 17 00:00:00 2001 From: jlheflin Date: Mon, 27 Jan 2025 10:16:09 -0600 Subject: [PATCH 38/59] removed indent for modules, not needed --- src/pluginplay/printing/mermaid.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 350a7db89..7a8c747c5 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -21,7 +21,7 @@ void print_submods(const std::string module_key, const pluginplay::ModuleManager& mm, std::stringstream& ss, - int level) { + int level = 0) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules std::string indent_2((level + 1) * 4, '-'); @@ -49,10 +49,8 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { auto mod = mm.keys()[i]; - std::string indent_1(i * 4, '+'); - ss << indent_1; // First Indent: '' ss << "Step 1: " << mod << std::endl; - print_submods(mod, mm, ss, i); + print_submods(mod, mm, ss); } std::cout << ss.str(); return "Hello World!"; From 75e9a4269b08cf2942ec614be275da4ead1641ca Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Tue, 28 Jan 2025 12:06:44 -0600 Subject: [PATCH 39/59] function is now recursive --- src/pluginplay/printing/mermaid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 7a8c747c5..59aa027bc 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -40,6 +40,7 @@ void print_submods(const std::string module_key, ss << indent_3 << "Step 3: Submod Name: " << value.get_name() << "\n" << std::endl; + print_submods(value.get_name(), mm, ss, level + 1); } } } From 1bb7e5a60744948af374b146a9a971f8f28fb1d1 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 30 Jan 2025 15:26:10 -0600 Subject: [PATCH 40/59] bargain-bin GhostFragment test added --- .../pluginplay/printing/mermaid.cpp | 198 +++++++++++++++--- 1 file changed, 173 insertions(+), 25 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 89cd87a67..17d27bcb6 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -21,40 +21,188 @@ #include #include -#define DECLARE_TEST_MODULE(number) \ - DECLARE_MODULE(SubmodLvl##number); \ - inline MODULE_CTOR(SubmodLvl##number) { \ - satisfies_property_type(); \ - add_submodule("Submod " #number); \ - } \ - inline MODULE_RUN(SubmodLvl##number) { return results(); } -// Module Name: SubmodLvl# -// Submodule Name: Submod # +// #define DECLARE_TEST_MODULE(number) \ +// DECLARE_MODULE(SubmodLvl##number); \ +// inline MODULE_CTOR(SubmodLvl##number) { \ +// satisfies_property_type(); \ +// add_submodule("Submod " #number); \ +// } \ +// inline MODULE_RUN(SubmodLvl##number) { return results(); } +// // Module Name: SubmodLvl# +// // Submodule Name: Submod # -DECLARE_TEST_MODULE(3) -DECLARE_TEST_MODULE(2) -DECLARE_TEST_MODULE(1) +// DECLARE_TEST_MODULE(3) +// DECLARE_TEST_MODULE(2) +// DECLARE_TEST_MODULE(1) -#undef DECLARE_TEST_MODULE +// #undef DECLARE_TEST_MODULE -DECLARE_MODULE(TooManySubmods); -inline MODULE_CTOR(TooManySubmods) { +// DECLARE_MODULE(TooManySubmods); +// inline MODULE_CTOR(TooManySubmods) { +// satisfies_property_type(); +// add_submodule("Submods"); +// } +// inline MODULE_RUN(TooManySubmods) { return results(); } + + +DECLARE_MODULE(Allnmers); +inline MODULE_CTOR(Allnmers) { + satisfies_property_type(); + add_submodule("Monomer Maker"); +} +inline MODULE_RUN(Allnmers) { return results(); } + +DECLARE_MODULE(AtomicCapping); +inline MODULE_CTOR(AtomicCapping) { + satisfies_property_type(); +} +inline MODULE_RUN(AtomicCapping) { return results(); } + +DECLARE_MODULE(BondBasedFragmenter); +inline MODULE_CTOR(BondBasedFragmenter) { + satisfies_property_type(); +} +inline MODULE_RUN(BondBasedFragmenter) { return results(); } + +DECLARE_MODULE(BrokenBonds); +inline MODULE_CTOR(BrokenBonds) { + satisfies_property_type(); +} +inline MODULE_RUN(BrokenBonds) { return results(); } + +DECLARE_MODULE(ClusterPartition); +inline MODULE_CTOR(ClusterPartition) { + satisfies_property_type(); +} +inline MODULE_RUN(ClusterPartition) { return results(); } + +DECLARE_MODULE(CovalentRadius); +inline MODULE_CTOR(CovalentRadius) { + satisfies_property_type(); +} +inline MODULE_RUN(CovalentRadius) { return results(); } + +DECLARE_MODULE(DCLCCapping); +inline MODULE_CTOR(DCLCCapping) { + satisfies_property_type(); + add_submodule("Connectivity"); +} +inline MODULE_RUN(DCLCCapping) { return results(); } + +DECLARE_MODULE(EnergyMethod); +inline MODULE_CTOR(EnergyMethod) { + satisfies_property_type(); +} +inline MODULE_RUN(EnergyMethod) { return results(); } + +DECLARE_MODULE(FragmentBasedMethod); +inline MODULE_CTOR(FragmentBasedMethod) { satisfies_property_type(); - add_submodule("Submods"); + add_submodule("Energy method"); + add_submodule("Subsystem former"); + add_submodule("Weighter"); + +} +inline MODULE_RUN(FragmentBasedMethod) { return results(); } + +DECLARE_MODULE(FragmentDriver); +inline MODULE_CTOR(FragmentDriver) { + satisfies_property_type(); + add_submodule("Atomic connectivity"); + add_submodule("Cap broken bonds"); + add_submodule("Find broken bonds"); + add_submodule("Fragment builder"); + add_submodule("Intersection finder"); + add_submodule("Molecular graph"); + add_submodule("N-mer builder"); + +} +inline MODULE_RUN(FragmentDriver) { return results(); } + +DECLARE_MODULE(FragmentedChemicalSystemDriver); +inline MODULE_CTOR(FragmentedChemicalSystemDriver) { + satisfies_property_type(); + add_submodule("Fragmenter"); +} +inline MODULE_RUN(FragmentedChemicalSystemDriver) { return results(); } + +DECLARE_MODULE(GMBEWeights); +inline MODULE_CTOR(GMBEWeights) { + satisfies_property_type(); +} +inline MODULE_RUN(GMBEWeights) { return results(); } + +DECLARE_MODULE(HeavyAtomPartition); +inline MODULE_CTOR(HeavyAtomPartition) { + satisfies_property_type(); + add_submodule("Connectivity"); +} +inline MODULE_RUN(HeavyAtomPartition) { return results(); } + +DECLARE_MODULE(Intersections); +inline MODULE_CTOR(Intersections) { + satisfies_property_type(); +} +inline MODULE_RUN(Intersections) { return results(); } + +DECLARE_MODULE(NuclearGraph); +inline MODULE_CTOR(NuclearGraph) { + satisfies_property_type(); + add_submodule("Connectivity"); + add_submodule("Nodes"); } -inline MODULE_RUN(TooManySubmods) { return results(); } -// Make it to where the modules branch +inline MODULE_RUN(NuclearGraph) { return results(); } + +DECLARE_MODULE(WeightedDistance); +inline MODULE_CTOR(WeightedDistance) { + satisfies_property_type(); +} +inline MODULE_RUN(WeightedDistance) { return results(); } + + TEST_CASE("hello_world") { pluginplay::ModuleManager mm; // Load in Modules - mm.add_module("SubmodLvl3"); - mm.add_module("SubmodLvl2"); - mm.add_module("SubmodLvl1"); - mm.add_module("TooManySubmods"); - mm.change_submod("TooManySubmods", "Submods", "SubmodLvl1"); - mm.change_submod("SubmodLvl1", "Submod 1", "SubmodLvl2"); - mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); + // mm.add_module("SubmodLvl3"); + // mm.add_module("SubmodLvl2"); + // mm.add_module("SubmodLvl1"); + // mm.add_module("TooManySubmods"); + // mm.change_submod("TooManySubmods", "Submods", "SubmodLvl1"); + // mm.change_submod("SubmodLvl1", "Submod 1", "SubmodLvl2"); + // mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); + mm.add_module("All nmers"); + mm.add_module("Atomic Capping"); + mm.add_module("Bond-Based Fragmenter"); + mm.add_module("Broken Bonds"); + mm.add_module("Cluster Partition"); + mm.add_module("Covalent Radius"); + mm.add_module("DCLC Capping"); + mm.add_module("Energy Method"); + mm.add_module("Fragment Based Method"); + mm.add_module("Fragment Driver"); + mm.add_module("FragmentedChemicalSystem Driver"); + mm.add_module("GMBE Weights"); + mm.add_module("Heavy Atom Partition"); + mm.add_module("Intersections"); + mm.add_module("Nuclear Graph"); + mm.add_module("Weighted Distance"); + mm.change_submod("DCLC Capping", "Connectivity", "Covalent Radius"); + mm.change_submod("Fragment Based Method", "Energy method", "Energy Method"); + mm.change_submod("Fragment Based Method", "Subsystem former", "FragmentedChemicalSystem Driver"); + mm.change_submod("Fragment Based Method", "Weighter", "GMBE Weights"); + mm.change_submod("Fragment Driver", "Atomic connectivity", "Covalent Radius"); + mm.change_submod("Fragment Driver", "Cap broken bonds", "Weighted Distance"); + mm.change_submod("Fragment Driver", "Find broken bonds", "Broken Bonds"); + mm.change_submod("Fragment Driver", "Fragment builder", "Bond-Based Fragmenter"); + mm.change_submod("Fragment Driver", "Intersection finder", "Intersections"); + mm.change_submod("Fragment Driver", "Molecular graph", "Nuclear Graph"); + mm.change_submod("Fragment Driver", "N-mer builder", "All nmers"); + mm.change_submod("FragmentedChemicalSystem Driver", "Fragmenter", "Fragment Driver"); + mm.change_submod("Heavy Atom Partition", "Connectivity", "Covalent Radius"); + mm.change_submod("Nuclear Graph", "Connectivity", "Covalent Radius"); + mm.change_submod("Nuclear Graph", "Nodes", "Heavy Atom Partition"); + SECTION("huh") { auto hello = create_mermaid_graph(mm); From 8951fd15b5ab607c910be276a8ca9b59a187da34 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 30 Jan 2025 15:27:27 -0600 Subject: [PATCH 41/59] commiting clang-format changes, but this time with more pizzazz --- .../pluginplay/printing/mermaid.cpp | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 17d27bcb6..6618d368b 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -44,7 +44,6 @@ // } // inline MODULE_RUN(TooManySubmods) { return results(); } - DECLARE_MODULE(Allnmers); inline MODULE_CTOR(Allnmers) { satisfies_property_type(); @@ -65,9 +64,7 @@ inline MODULE_CTOR(BondBasedFragmenter) { inline MODULE_RUN(BondBasedFragmenter) { return results(); } DECLARE_MODULE(BrokenBonds); -inline MODULE_CTOR(BrokenBonds) { - satisfies_property_type(); -} +inline MODULE_CTOR(BrokenBonds) { satisfies_property_type(); } inline MODULE_RUN(BrokenBonds) { return results(); } DECLARE_MODULE(ClusterPartition); @@ -90,9 +87,7 @@ inline MODULE_CTOR(DCLCCapping) { inline MODULE_RUN(DCLCCapping) { return results(); } DECLARE_MODULE(EnergyMethod); -inline MODULE_CTOR(EnergyMethod) { - satisfies_property_type(); -} +inline MODULE_CTOR(EnergyMethod) { satisfies_property_type(); } inline MODULE_RUN(EnergyMethod) { return results(); } DECLARE_MODULE(FragmentBasedMethod); @@ -101,7 +96,6 @@ inline MODULE_CTOR(FragmentBasedMethod) { add_submodule("Energy method"); add_submodule("Subsystem former"); add_submodule("Weighter"); - } inline MODULE_RUN(FragmentBasedMethod) { return results(); } @@ -115,7 +109,6 @@ inline MODULE_CTOR(FragmentDriver) { add_submodule("Intersection finder"); add_submodule("Molecular graph"); add_submodule("N-mer builder"); - } inline MODULE_RUN(FragmentDriver) { return results(); } @@ -127,9 +120,7 @@ inline MODULE_CTOR(FragmentedChemicalSystemDriver) { inline MODULE_RUN(FragmentedChemicalSystemDriver) { return results(); } DECLARE_MODULE(GMBEWeights); -inline MODULE_CTOR(GMBEWeights) { - satisfies_property_type(); -} +inline MODULE_CTOR(GMBEWeights) { satisfies_property_type(); } inline MODULE_RUN(GMBEWeights) { return results(); } DECLARE_MODULE(HeavyAtomPartition); @@ -159,8 +150,6 @@ inline MODULE_CTOR(WeightedDistance) { } inline MODULE_RUN(WeightedDistance) { return results(); } - - TEST_CASE("hello_world") { pluginplay::ModuleManager mm; // Load in Modules @@ -181,7 +170,8 @@ TEST_CASE("hello_world") { mm.add_module("Energy Method"); mm.add_module("Fragment Based Method"); mm.add_module("Fragment Driver"); - mm.add_module("FragmentedChemicalSystem Driver"); + mm.add_module( + "FragmentedChemicalSystem Driver"); mm.add_module("GMBE Weights"); mm.add_module("Heavy Atom Partition"); mm.add_module("Intersections"); @@ -189,21 +179,25 @@ TEST_CASE("hello_world") { mm.add_module("Weighted Distance"); mm.change_submod("DCLC Capping", "Connectivity", "Covalent Radius"); mm.change_submod("Fragment Based Method", "Energy method", "Energy Method"); - mm.change_submod("Fragment Based Method", "Subsystem former", "FragmentedChemicalSystem Driver"); + mm.change_submod("Fragment Based Method", "Subsystem former", + "FragmentedChemicalSystem Driver"); mm.change_submod("Fragment Based Method", "Weighter", "GMBE Weights"); - mm.change_submod("Fragment Driver", "Atomic connectivity", "Covalent Radius"); - mm.change_submod("Fragment Driver", "Cap broken bonds", "Weighted Distance"); + mm.change_submod("Fragment Driver", "Atomic connectivity", + "Covalent Radius"); + mm.change_submod("Fragment Driver", "Cap broken bonds", + "Weighted Distance"); mm.change_submod("Fragment Driver", "Find broken bonds", "Broken Bonds"); - mm.change_submod("Fragment Driver", "Fragment builder", "Bond-Based Fragmenter"); + mm.change_submod("Fragment Driver", "Fragment builder", + "Bond-Based Fragmenter"); mm.change_submod("Fragment Driver", "Intersection finder", "Intersections"); mm.change_submod("Fragment Driver", "Molecular graph", "Nuclear Graph"); mm.change_submod("Fragment Driver", "N-mer builder", "All nmers"); - mm.change_submod("FragmentedChemicalSystem Driver", "Fragmenter", "Fragment Driver"); + mm.change_submod("FragmentedChemicalSystem Driver", "Fragmenter", + "Fragment Driver"); mm.change_submod("Heavy Atom Partition", "Connectivity", "Covalent Radius"); mm.change_submod("Nuclear Graph", "Connectivity", "Covalent Radius"); mm.change_submod("Nuclear Graph", "Nodes", "Heavy Atom Partition"); - SECTION("huh") { auto hello = create_mermaid_graph(mm); std::cout << "Bro the test ran but idk if the internals ran" From 3f3fbc6ec095c110c0f54ae7a62a09cc2c290291 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 30 Jan 2025 15:37:06 -0600 Subject: [PATCH 42/59] removed multi-line comments --- .../pluginplay/printing/mermaid.cpp | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 6618d368b..07f0a5901 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -21,29 +21,6 @@ #include #include -// #define DECLARE_TEST_MODULE(number) \ -// DECLARE_MODULE(SubmodLvl##number); \ -// inline MODULE_CTOR(SubmodLvl##number) { \ -// satisfies_property_type(); \ -// add_submodule("Submod " #number); \ -// } \ -// inline MODULE_RUN(SubmodLvl##number) { return results(); } -// // Module Name: SubmodLvl# -// // Submodule Name: Submod # - -// DECLARE_TEST_MODULE(3) -// DECLARE_TEST_MODULE(2) -// DECLARE_TEST_MODULE(1) - -// #undef DECLARE_TEST_MODULE - -// DECLARE_MODULE(TooManySubmods); -// inline MODULE_CTOR(TooManySubmods) { -// satisfies_property_type(); -// add_submodule("Submods"); -// } -// inline MODULE_RUN(TooManySubmods) { return results(); } - DECLARE_MODULE(Allnmers); inline MODULE_CTOR(Allnmers) { satisfies_property_type(); @@ -152,14 +129,6 @@ inline MODULE_RUN(WeightedDistance) { return results(); } TEST_CASE("hello_world") { pluginplay::ModuleManager mm; - // Load in Modules - // mm.add_module("SubmodLvl3"); - // mm.add_module("SubmodLvl2"); - // mm.add_module("SubmodLvl1"); - // mm.add_module("TooManySubmods"); - // mm.change_submod("TooManySubmods", "Submods", "SubmodLvl1"); - // mm.change_submod("SubmodLvl1", "Submod 1", "SubmodLvl2"); - // mm.change_submod("SubmodLvl2", "Submod 2", "SubmodLvl3"); mm.add_module("All nmers"); mm.add_module("Atomic Capping"); mm.add_module("Bond-Based Fragmenter"); From 9b5d8ab73a94e8528cd7f438f474bc3f53f3c9b1 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 30 Jan 2025 17:27:30 -0600 Subject: [PATCH 43/59] started conversion to mermaid graph output --- src/pluginplay/printing/mermaid.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 59aa027bc..4f8c93cfb 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -24,22 +24,16 @@ void print_submods(const std::string module_key, int level = 0) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - std::string indent_2((level + 1) * 4, '-'); - std::string indent_3((level + 1) * 4, '/'); - + char letter = 65 + level; + // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << indent_2 << "Step 2: Submod ID: " << key - << std::endl; // Second indent: ---- + ss << "\t" << letter + level << level + 1 << "[" << key << "]\n"; // Second indent: ---- if(value.has_module() == false) { - ss << indent_3 // Third indent ----- - << "Step 3: Submod Name: No Submodule associated with Key yet\n" - << std::endl; + ss << "\t" << letter + level << level + 2 << "[Submod Name: No Submodule associated with Key]\n"; continue; } else { - ss << indent_3 << "Step 3: Submod Name: " << value.get_name() - << "\n" - << std::endl; + ss << "\t" << letter + level << level + 2 << "[" << value.get_name() << "]\n"; // Second indent: ---- print_submods(value.get_name(), mm, ss, level + 1); } } @@ -49,8 +43,10 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { + ss << "flowchart LR\n"; auto mod = mm.keys()[i]; - ss << "Step 1: " << mod << std::endl; + char letter = 65; + ss <<"\t" << letter << "[" << mod << "]\n"; print_submods(mod, mm, ss); } std::cout << ss.str(); From 9569cbc5457af373857693a17a0cd8dfb18a0b67 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 30 Jan 2025 17:28:35 -0600 Subject: [PATCH 44/59] clang-format, but with less pizzazz --- src/pluginplay/printing/mermaid.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 4f8c93cfb..7b481a58d 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -24,16 +24,19 @@ void print_submods(const std::string module_key, int level = 0) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - char letter = 65 + level; - + char letter = 65 + level; + // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << "\t" << letter + level << level + 1 << "[" << key << "]\n"; // Second indent: ---- + ss << "\t" << letter + level << level + 1 << "[" << key + << "]\n"; // Second indent: ---- if(value.has_module() == false) { - ss << "\t" << letter + level << level + 2 << "[Submod Name: No Submodule associated with Key]\n"; + ss << "\t" << letter + level << level + 2 + << "[Submod Name: No Submodule associated with Key]\n"; continue; } else { - ss << "\t" << letter + level << level + 2 << "[" << value.get_name() << "]\n"; // Second indent: ---- + ss << "\t" << letter + level << level + 2 << "[" << value.get_name() + << "]\n"; // Second indent: ---- print_submods(value.get_name(), mm, ss, level + 1); } } @@ -44,9 +47,9 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { ss << "flowchart LR\n"; - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; char letter = 65; - ss <<"\t" << letter << "[" << mod << "]\n"; + ss << "\t" << letter << "[" << mod << "]\n"; print_submods(mod, mm, ss); } std::cout << ss.str(); From 74bdff60e7272692e2957f6006a6fee9ece5f264 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 6 Feb 2025 09:51:20 -0600 Subject: [PATCH 45/59] fixed the letter issue --- src/pluginplay/printing/mermaid.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 7b481a58d..07a7d987d 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -24,18 +24,19 @@ void print_submods(const std::string module_key, int level = 0) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - char letter = 65 + level; + char letter = (65 + level); // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << "\t" << letter + level << level + 1 << "[" << key + letter += level; + ss << "\t" << letter << level + 1 << "[" << key << "]\n"; // Second indent: ---- if(value.has_module() == false) { - ss << "\t" << letter + level << level + 2 + ss << "\t" << letter << level + 2 << "[Submod Name: No Submodule associated with Key]\n"; continue; } else { - ss << "\t" << letter + level << level + 2 << "[" << value.get_name() + ss << "\t" << letter << level + 2 << "[" << value.get_name() << "]\n"; // Second indent: ---- print_submods(value.get_name(), mm, ss, level + 1); } From e373ecf30751d785595fe611afc6b1e299faed02 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 13 Feb 2025 10:29:34 -0600 Subject: [PATCH 46/59] adjusted src mermaid.cpp to better follow the mermaid style --- src/pluginplay/printing/mermaid.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 07a7d987d..b7fd42a55 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -21,23 +21,21 @@ void print_submods(const std::string module_key, const pluginplay::ModuleManager& mm, std::stringstream& ss, - int level = 0) { + int level) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - char letter = (65 + level); + char mod_letter = 65; + char submod_letter = (65 + level); // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - letter += level; - ss << "\t" << letter << level + 1 << "[" << key - << "]\n"; // Second indent: ---- + ss << "\n\tA--" << "|" << key << "|--"; if(value.has_module() == false) { - ss << "\t" << letter << level + 2 - << "[Submod Name: No Submodule associated with Key]\n"; + ss << submod_letter << level + 1 + << "[No Submodule associated with Key]\n"; continue; } else { - ss << "\t" << letter << level + 2 << "[" << value.get_name() - << "]\n"; // Second indent: ---- + ss << submod_letter << level + 1 << "[" << value.get_name() << "]"; print_submods(value.get_name(), mm, ss, level + 1); } } @@ -47,11 +45,11 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; for(decltype(n_modules) i = 0; i < n_modules; i++) { - ss << "flowchart LR\n"; + ss << "\nflowchart LR\n"; auto mod = mm.keys()[i]; char letter = 65; - ss << "\t" << letter << "[" << mod << "]\n"; - print_submods(mod, mm, ss); + ss << "\t" << letter << "[" << mod << "]"; + print_submods(mod, mm, ss, 0); } std::cout << ss.str(); return "Hello World!"; From 1748a545ae662311fa7e718971346c271aaa8a72 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 13 Feb 2025 16:30:51 +0000 Subject: [PATCH 47/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index b7fd42a55..5259797ac 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -29,7 +29,8 @@ void print_submods(const std::string module_key, // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << "\n\tA--" << "|" << key << "|--"; + ss << "\n\tA--" + << "|" << key << "|--"; if(value.has_module() == false) { ss << submod_letter << level + 1 << "[No Submodule associated with Key]\n"; From 31ab2f152b5beb51bc5984ed99187e23fa25c35b Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Sun, 16 Feb 2025 19:17:58 -0600 Subject: [PATCH 48/59] Functional Mermaid Graph now implemented in mermaid.cpp --- src/pluginplay/printing/mermaid.cpp | 45 ++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 5259797ac..063568c93 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -19,38 +19,57 @@ #include #include +void add_letter(std::string& code) { + for (int i = 2; i >= 0; --i) { + if (code[i] == 'Z') { + code[i] = 'A'; + } else { + code[i]++; + return; + } + } +} + void print_submods(const std::string module_key, - const pluginplay::ModuleManager& mm, std::stringstream& ss, - int level) { + const pluginplay::ModuleManager& mm, std::stringstream& ss, std::string& module_code) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - char mod_letter = 65; - char submod_letter = (65 + level); + auto main_mod_code = module_code; // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << "\n\tA--" - << "|" << key << "|--"; + ss << "\n\t" + << main_mod_code + << "-->" + << "|" + << key + << "| "; if(value.has_module() == false) { - ss << submod_letter << level + 1 - << "[No Submodule associated with Key]\n"; + add_letter(module_code); + ss << module_code + << "[No Submodule associated with Key]"; continue; } else { - ss << submod_letter << level + 1 << "[" << value.get_name() << "]"; - print_submods(value.get_name(), mm, ss, level + 1); + add_letter(module_code); + ss << module_code << "[" << value.get_name() << "]"; + print_submods(value.get_name(), mm, ss, module_code); } } } + std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; + std::string module_code = "AAA"; for(decltype(n_modules) i = 0; i < n_modules; i++) { + ss << "\n```mermaid"; ss << "\nflowchart LR\n"; auto mod = mm.keys()[i]; - char letter = 65; - ss << "\t" << letter << "[" << mod << "]"; - print_submods(mod, mm, ss, 0); + ss << "\t" << module_code << "[" << mod << "]"; + print_submods(mod, mm, ss, module_code); + ss << "\n```"; + add_letter(module_code); } std::cout << ss.str(); return "Hello World!"; From 2f33e423bdb5b4fd78ecf484477a4cd000d0d073 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 17 Feb 2025 01:18:58 +0000 Subject: [PATCH 49/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 063568c93..b732e0cc7 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -20,8 +20,8 @@ #include void add_letter(std::string& code) { - for (int i = 2; i >= 0; --i) { - if (code[i] == 'Z') { + for(int i = 2; i >= 0; --i) { + if(code[i] == 'Z') { code[i] = 'A'; } else { code[i]++; @@ -31,23 +31,19 @@ void add_letter(std::string& code) { } void print_submods(const std::string module_key, - const pluginplay::ModuleManager& mm, std::stringstream& ss, std::string& module_code) { + const pluginplay::ModuleManager& mm, std::stringstream& ss, + std::string& module_code) { const auto& mm_module = mm.at(module_key); // Results in a PluginPlay Module const auto& submods = mm_module.submods(); // Results in list of Submodules - auto main_mod_code = module_code; + auto main_mod_code = module_code; // Key is the ID/Tag, Value is the reference to the Module for(const auto& [key, value] : submods) { - ss << "\n\t" - << main_mod_code - << "-->" - << "|" - << key - << "| "; + ss << "\n\t" << main_mod_code << "-->" + << "|" << key << "| "; if(value.has_module() == false) { add_letter(module_code); - ss << module_code - << "[No Submodule associated with Key]"; + ss << module_code << "[No Submodule associated with Key]"; continue; } else { add_letter(module_code); @@ -57,7 +53,6 @@ void print_submods(const std::string module_key, } } - std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; @@ -65,7 +60,7 @@ std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { for(decltype(n_modules) i = 0; i < n_modules; i++) { ss << "\n```mermaid"; ss << "\nflowchart LR\n"; - auto mod = mm.keys()[i]; + auto mod = mm.keys()[i]; ss << "\t" << module_code << "[" << mod << "]"; print_submods(mod, mm, ss, module_code); ss << "\n```"; From 85be34213551f55ab415b0ca084df8ff96f544e4 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 13 Mar 2025 15:40:22 -0500 Subject: [PATCH 50/59] Adjusted tests to unit tests instead of an integration test --- include/pluginplay/printing/mermaid.hpp | 8 +- src/pluginplay/printing/mermaid.cpp | 25 +- .../pluginplay/printing/mermaid.cpp | 246 +++++++++--------- 3 files changed, 139 insertions(+), 140 deletions(-) diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index 7b98950f3..42adcfc87 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -16,6 +16,10 @@ #pragma once #include -#include +#include -std::string create_mermaid_graph(const pluginplay::ModuleManager& mm); +std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm); + +void print_submods(const std::string module_key, + const pluginplay::ModuleManager& mm, std::stringstream& ss, + std::string& module_code); diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index b732e0cc7..3afb8c6f5 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -53,19 +53,24 @@ void print_submods(const std::string module_key, } } -std::string create_mermaid_graph(const pluginplay::ModuleManager& mm) { +std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; std::string module_code = "AAA"; - for(decltype(n_modules) i = 0; i < n_modules; i++) { - ss << "\n```mermaid"; - ss << "\nflowchart LR\n"; - auto mod = mm.keys()[i]; - ss << "\t" << module_code << "[" << mod << "]"; - print_submods(mod, mm, ss, module_code); - ss << "\n```"; - add_letter(module_code); + if (n_modules == 0) { + ss << "No modules are loaded, load some modules!"; + } + else { + for(decltype(n_modules) i = 0; i < n_modules; i++) { + ss << "\n```mermaid"; + ss << "\nflowchart LR\n"; + auto mod = mm.keys()[i]; + ss << "\t" << module_code << "[" << mod << "]"; + print_submods(mod, mm, ss, module_code); + ss << "\n```"; + add_letter(module_code); + } } std::cout << ss.str(); - return "Hello World!"; + return ss; } diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 07f0a5901..0b4e79696 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,161 +16,151 @@ #include "../catch.hpp" #include "../test_common.hpp" +#include "catch2/catch_test_macros.hpp" #include "module/macros.hpp" +#include "module_manager/module_manager_class.hpp" #include "unit_testing_pts.hpp" #include #include +#include +#include -DECLARE_MODULE(Allnmers); -inline MODULE_CTOR(Allnmers) { - satisfies_property_type(); - add_submodule("Monomer Maker"); +DECLARE_MODULE(OneModule); +inline MODULE_CTOR(OneModule) { + satisfies_property_type(); } -inline MODULE_RUN(Allnmers) { return results(); } +inline MODULE_RUN(OneModule) { return results();} -DECLARE_MODULE(AtomicCapping); -inline MODULE_CTOR(AtomicCapping) { - satisfies_property_type(); +DECLARE_MODULE(TwoModule); +inline MODULE_CTOR(TwoModule) { + satisfies_property_type(); } -inline MODULE_RUN(AtomicCapping) { return results(); } +inline MODULE_RUN(TwoModule) { return results();} -DECLARE_MODULE(BondBasedFragmenter); -inline MODULE_CTOR(BondBasedFragmenter) { - satisfies_property_type(); +DECLARE_MODULE(ThreeModule); +inline MODULE_CTOR(ThreeModule) { + satisfies_property_type(); } -inline MODULE_RUN(BondBasedFragmenter) { return results(); } +inline MODULE_RUN(ThreeModule) { return results();} -DECLARE_MODULE(BrokenBonds); -inline MODULE_CTOR(BrokenBonds) { satisfies_property_type(); } -inline MODULE_RUN(BrokenBonds) { return results(); } - -DECLARE_MODULE(ClusterPartition); -inline MODULE_CTOR(ClusterPartition) { +DECLARE_MODULE(OneModuleSubTwo); +inline MODULE_CTOR(OneModuleSubTwo) { satisfies_property_type(); + add_submodule("Submodule"); } -inline MODULE_RUN(ClusterPartition) { return results(); } +inline MODULE_RUN(OneModuleSubTwo) { return results(); } -DECLARE_MODULE(CovalentRadius); -inline MODULE_CTOR(CovalentRadius) { +DECLARE_MODULE(TwoModuleSubThree); +inline MODULE_CTOR(TwoModuleSubThree) { satisfies_property_type(); + add_submodule("Submodule"); } -inline MODULE_RUN(CovalentRadius) { return results(); } +inline MODULE_RUN(TwoModuleSubThree) { return results(); } -DECLARE_MODULE(DCLCCapping); -inline MODULE_CTOR(DCLCCapping) { +DECLARE_MODULE(OneModuleSubTwoThree); +inline MODULE_CTOR(OneModuleSubTwoThree) { satisfies_property_type(); - add_submodule("Connectivity"); + add_submodule("Submodule 1"); + add_submodule("Submodule 2"); } -inline MODULE_RUN(DCLCCapping) { return results(); } +inline MODULE_RUN(OneModuleSubTwoThree) { return results(); } -DECLARE_MODULE(EnergyMethod); -inline MODULE_CTOR(EnergyMethod) { satisfies_property_type(); } -inline MODULE_RUN(EnergyMethod) { return results(); } -DECLARE_MODULE(FragmentBasedMethod); -inline MODULE_CTOR(FragmentBasedMethod) { - satisfies_property_type(); - add_submodule("Energy method"); - add_submodule("Subsystem former"); - add_submodule("Weighter"); -} -inline MODULE_RUN(FragmentBasedMethod) { return results(); } +TEST_CASE("Mermaid Graph") { -DECLARE_MODULE(FragmentDriver); -inline MODULE_CTOR(FragmentDriver) { - satisfies_property_type(); - add_submodule("Atomic connectivity"); - add_submodule("Cap broken bonds"); - add_submodule("Find broken bonds"); - add_submodule("Fragment builder"); - add_submodule("Intersection finder"); - add_submodule("Molecular graph"); - add_submodule("N-mer builder"); -} -inline MODULE_RUN(FragmentDriver) { return results(); } + SECTION("No Modules") { + pluginplay::ModuleManager no_mods; + auto hello = create_mermaid_graph(no_mods); + REQUIRE(hello.str() == "No modules are loaded, load some modules!"); + } -DECLARE_MODULE(FragmentedChemicalSystemDriver); -inline MODULE_CTOR(FragmentedChemicalSystemDriver) { - satisfies_property_type(); - add_submodule("Fragmenter"); -} -inline MODULE_RUN(FragmentedChemicalSystemDriver) { return results(); } + SECTION("One Module") { + pluginplay::ModuleManager one_mod; + one_mod.add_module("One Module"); + auto onemod = create_mermaid_graph(one_mod); + std::string val = "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; -DECLARE_MODULE(GMBEWeights); -inline MODULE_CTOR(GMBEWeights) { satisfies_property_type(); } -inline MODULE_RUN(GMBEWeights) { return results(); } + REQUIRE(val == onemod.str()); + } -DECLARE_MODULE(HeavyAtomPartition); -inline MODULE_CTOR(HeavyAtomPartition) { - satisfies_property_type(); - add_submodule("Connectivity"); -} -inline MODULE_RUN(HeavyAtomPartition) { return results(); } + SECTION("2 Modules, Not Related") { + std::stringstream ss; + pluginplay::ModuleManager two_mods_unrelated; + two_mods_unrelated.add_module("One Module"); + two_mods_unrelated.add_module("Two Module"); + auto twomod = create_mermaid_graph(two_mods_unrelated); + ss << "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; + ss << "\n```mermaid\nflowchart LR\n\tAAB[Two Module]\n```"; -DECLARE_MODULE(Intersections); -inline MODULE_CTOR(Intersections) { - satisfies_property_type(); -} -inline MODULE_RUN(Intersections) { return results(); } + REQUIRE(ss.str() == twomod.str()); + } + + SECTION("2 Modules, Related") { + std::stringstream ss2; + pluginplay::ModuleManager two_mods_related; + two_mods_related.add_module("One Module Submod Two"); + two_mods_related.add_module("Two Module"); + two_mods_related.change_submod("One Module Submod Two", "Submodule", "Two Module"); + auto twomodrelated = create_mermaid_graph(two_mods_related); + ss2 << "\n```mermaid\nflowchart LR\n\tAAA[One Module Submod Two]\n"; + ss2 << "\tAAA-->|Submodule| AAB[Two Module]\n```"; + ss2 << "\n```mermaid\nflowchart LR\n\tAAC[Two Module]\n```"; + REQUIRE(ss2.str() == twomodrelated.str()); + } -DECLARE_MODULE(NuclearGraph); -inline MODULE_CTOR(NuclearGraph) { - satisfies_property_type(); - add_submodule("Connectivity"); - add_submodule("Nodes"); -} -inline MODULE_RUN(NuclearGraph) { return results(); } + SECTION("3 Modules, Nested") { + std::stringstream ss3; + pluginplay::ModuleManager three_mods_recursive; + three_mods_recursive.add_module("One Module Submod Two"); + three_mods_recursive.add_module("Two Module Submod Three"); + three_mods_recursive.add_module("Three Module"); + three_mods_recursive.change_submod("One Module Submod Two", "Submodule", "Two Module Submod Three"); + three_mods_recursive.change_submod("Two Module Submod Three", "Submodule", "Three Module"); + auto threemodrecursive = create_mermaid_graph(three_mods_recursive); + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAA[One Module Submod Two]\n"; + ss3 << "\tAAA-->|Submodule| AAB[Two Module Submod Three]\n"; + ss3 << "\tAAB-->|Submodule| AAC[Three Module]\n"; + ss3 << "```"; + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAD[Three Module]\n"; + ss3 << "```"; + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAE[Two Module Submod Three]\n"; + ss3 << "\tAAE-->|Submodule| AAF[Three Module]\n"; + ss3 << "```"; + + REQUIRE(ss3.str() == threemodrecursive.str()); + } -DECLARE_MODULE(WeightedDistance); -inline MODULE_CTOR(WeightedDistance) { - satisfies_property_type(); -} -inline MODULE_RUN(WeightedDistance) { return results(); } - -TEST_CASE("hello_world") { - pluginplay::ModuleManager mm; - mm.add_module("All nmers"); - mm.add_module("Atomic Capping"); - mm.add_module("Bond-Based Fragmenter"); - mm.add_module("Broken Bonds"); - mm.add_module("Cluster Partition"); - mm.add_module("Covalent Radius"); - mm.add_module("DCLC Capping"); - mm.add_module("Energy Method"); - mm.add_module("Fragment Based Method"); - mm.add_module("Fragment Driver"); - mm.add_module( - "FragmentedChemicalSystem Driver"); - mm.add_module("GMBE Weights"); - mm.add_module("Heavy Atom Partition"); - mm.add_module("Intersections"); - mm.add_module("Nuclear Graph"); - mm.add_module("Weighted Distance"); - mm.change_submod("DCLC Capping", "Connectivity", "Covalent Radius"); - mm.change_submod("Fragment Based Method", "Energy method", "Energy Method"); - mm.change_submod("Fragment Based Method", "Subsystem former", - "FragmentedChemicalSystem Driver"); - mm.change_submod("Fragment Based Method", "Weighter", "GMBE Weights"); - mm.change_submod("Fragment Driver", "Atomic connectivity", - "Covalent Radius"); - mm.change_submod("Fragment Driver", "Cap broken bonds", - "Weighted Distance"); - mm.change_submod("Fragment Driver", "Find broken bonds", "Broken Bonds"); - mm.change_submod("Fragment Driver", "Fragment builder", - "Bond-Based Fragmenter"); - mm.change_submod("Fragment Driver", "Intersection finder", "Intersections"); - mm.change_submod("Fragment Driver", "Molecular graph", "Nuclear Graph"); - mm.change_submod("Fragment Driver", "N-mer builder", "All nmers"); - mm.change_submod("FragmentedChemicalSystem Driver", "Fragmenter", - "Fragment Driver"); - mm.change_submod("Heavy Atom Partition", "Connectivity", "Covalent Radius"); - mm.change_submod("Nuclear Graph", "Connectivity", "Covalent Radius"); - mm.change_submod("Nuclear Graph", "Nodes", "Heavy Atom Partition"); - - SECTION("huh") { - auto hello = create_mermaid_graph(mm); - std::cout << "Bro the test ran but idk if the internals ran" - << std::endl; - REQUIRE(hello == "Hello World!"); + SECTION("3 Modules, Branched") { + std::stringstream ss4; + pluginplay::ModuleManager three_mods_branched; + three_mods_branched.add_module("One Module Submod Two Three"); + three_mods_branched.add_module("One Module"); + three_mods_branched.add_module("Two Module"); + three_mods_branched.change_submod("One Module Submod Two Three", "Submodule 1", "One Module"); + three_mods_branched.change_submod("One Module Submod Two Three", "Submodule 2", "Two Module"); + auto threemodsbranched = create_mermaid_graph(three_mods_branched); + + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAA[One Module]\n"; + ss4 << "```"; + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAB[One Module Submod Two Three]\n"; + ss4 << "\tAAB-->|Submodule 1| AAC[One Module]\n"; + ss4 << "\tAAB-->|Submodule 2| AAD[Two Module]\n"; + ss4 << "```"; + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAE[Two Module]\n"; + ss4 << "```"; + + REQUIRE(ss4.str() == threemodsbranched.str()); } } From 2cd6ca00beb32883a6d5648365e5056d78f47613 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 13 Mar 2025 20:41:29 +0000 Subject: [PATCH 51/59] Committing clang-format changes --- src/pluginplay/printing/mermaid.cpp | 5 +- .../pluginplay/printing/mermaid.cpp | 142 +++++++++--------- 2 files changed, 73 insertions(+), 74 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 3afb8c6f5..b7ff33858 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -57,10 +57,9 @@ std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm) { auto n_modules = mm.size(); std::stringstream ss; std::string module_code = "AAA"; - if (n_modules == 0) { + if(n_modules == 0) { ss << "No modules are loaded, load some modules!"; - } - else { + } else { for(decltype(n_modules) i = 0; i < n_modules; i++) { ss << "\n```mermaid"; ss << "\nflowchart LR\n"; diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 0b4e79696..36215c9a7 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -26,22 +26,16 @@ #include DECLARE_MODULE(OneModule); -inline MODULE_CTOR(OneModule) { - satisfies_property_type(); -} -inline MODULE_RUN(OneModule) { return results();} +inline MODULE_CTOR(OneModule) { satisfies_property_type(); } +inline MODULE_RUN(OneModule) { return results(); } DECLARE_MODULE(TwoModule); -inline MODULE_CTOR(TwoModule) { - satisfies_property_type(); -} -inline MODULE_RUN(TwoModule) { return results();} +inline MODULE_CTOR(TwoModule) { satisfies_property_type(); } +inline MODULE_RUN(TwoModule) { return results(); } DECLARE_MODULE(ThreeModule); -inline MODULE_CTOR(ThreeModule) { - satisfies_property_type(); -} -inline MODULE_RUN(ThreeModule) { return results();} +inline MODULE_CTOR(ThreeModule) { satisfies_property_type(); } +inline MODULE_RUN(ThreeModule) { return results(); } DECLARE_MODULE(OneModuleSubTwo); inline MODULE_CTOR(OneModuleSubTwo) { @@ -65,9 +59,7 @@ inline MODULE_CTOR(OneModuleSubTwoThree) { } inline MODULE_RUN(OneModuleSubTwoThree) { return results(); } - TEST_CASE("Mermaid Graph") { - SECTION("No Modules") { pluginplay::ModuleManager no_mods; auto hello = create_mermaid_graph(no_mods); @@ -75,12 +67,12 @@ TEST_CASE("Mermaid Graph") { } SECTION("One Module") { - pluginplay::ModuleManager one_mod; - one_mod.add_module("One Module"); - auto onemod = create_mermaid_graph(one_mod); - std::string val = "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; + pluginplay::ModuleManager one_mod; + one_mod.add_module("One Module"); + auto onemod = create_mermaid_graph(one_mod); + std::string val = "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; - REQUIRE(val == onemod.str()); + REQUIRE(val == onemod.str()); } SECTION("2 Modules, Not Related") { @@ -94,13 +86,14 @@ TEST_CASE("Mermaid Graph") { REQUIRE(ss.str() == twomod.str()); } - + SECTION("2 Modules, Related") { std::stringstream ss2; pluginplay::ModuleManager two_mods_related; two_mods_related.add_module("One Module Submod Two"); two_mods_related.add_module("Two Module"); - two_mods_related.change_submod("One Module Submod Two", "Submodule", "Two Module"); + two_mods_related.change_submod("One Module Submod Two", "Submodule", + "Two Module"); auto twomodrelated = create_mermaid_graph(two_mods_related); ss2 << "\n```mermaid\nflowchart LR\n\tAAA[One Module Submod Two]\n"; ss2 << "\tAAA-->|Submodule| AAB[Two Module]\n```"; @@ -109,58 +102,65 @@ TEST_CASE("Mermaid Graph") { } SECTION("3 Modules, Nested") { - std::stringstream ss3; - pluginplay::ModuleManager three_mods_recursive; - three_mods_recursive.add_module("One Module Submod Two"); - three_mods_recursive.add_module("Two Module Submod Three"); - three_mods_recursive.add_module("Three Module"); - three_mods_recursive.change_submod("One Module Submod Two", "Submodule", "Two Module Submod Three"); - three_mods_recursive.change_submod("Two Module Submod Three", "Submodule", "Three Module"); - auto threemodrecursive = create_mermaid_graph(three_mods_recursive); - ss3 << "\n```mermaid\n"; - ss3 << "flowchart LR\n"; - ss3 << "\tAAA[One Module Submod Two]\n"; - ss3 << "\tAAA-->|Submodule| AAB[Two Module Submod Three]\n"; - ss3 << "\tAAB-->|Submodule| AAC[Three Module]\n"; - ss3 << "```"; - ss3 << "\n```mermaid\n"; - ss3 << "flowchart LR\n"; - ss3 << "\tAAD[Three Module]\n"; - ss3 << "```"; - ss3 << "\n```mermaid\n"; - ss3 << "flowchart LR\n"; - ss3 << "\tAAE[Two Module Submod Three]\n"; - ss3 << "\tAAE-->|Submodule| AAF[Three Module]\n"; - ss3 << "```"; - - REQUIRE(ss3.str() == threemodrecursive.str()); + std::stringstream ss3; + pluginplay::ModuleManager three_mods_recursive; + three_mods_recursive.add_module( + "One Module Submod Two"); + three_mods_recursive.add_module( + "Two Module Submod Three"); + three_mods_recursive.add_module("Three Module"); + three_mods_recursive.change_submod("One Module Submod Two", "Submodule", + "Two Module Submod Three"); + three_mods_recursive.change_submod("Two Module Submod Three", + "Submodule", "Three Module"); + auto threemodrecursive = create_mermaid_graph(three_mods_recursive); + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAA[One Module Submod Two]\n"; + ss3 << "\tAAA-->|Submodule| AAB[Two Module Submod Three]\n"; + ss3 << "\tAAB-->|Submodule| AAC[Three Module]\n"; + ss3 << "```"; + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAD[Three Module]\n"; + ss3 << "```"; + ss3 << "\n```mermaid\n"; + ss3 << "flowchart LR\n"; + ss3 << "\tAAE[Two Module Submod Three]\n"; + ss3 << "\tAAE-->|Submodule| AAF[Three Module]\n"; + ss3 << "```"; + + REQUIRE(ss3.str() == threemodrecursive.str()); } SECTION("3 Modules, Branched") { - std::stringstream ss4; - pluginplay::ModuleManager three_mods_branched; - three_mods_branched.add_module("One Module Submod Two Three"); - three_mods_branched.add_module("One Module"); - three_mods_branched.add_module("Two Module"); - three_mods_branched.change_submod("One Module Submod Two Three", "Submodule 1", "One Module"); - three_mods_branched.change_submod("One Module Submod Two Three", "Submodule 2", "Two Module"); - auto threemodsbranched = create_mermaid_graph(three_mods_branched); - - ss4 << "\n```mermaid\n"; - ss4 << "flowchart LR\n"; - ss4 << "\tAAA[One Module]\n"; - ss4 << "```"; - ss4 << "\n```mermaid\n"; - ss4 << "flowchart LR\n"; - ss4 << "\tAAB[One Module Submod Two Three]\n"; - ss4 << "\tAAB-->|Submodule 1| AAC[One Module]\n"; - ss4 << "\tAAB-->|Submodule 2| AAD[Two Module]\n"; - ss4 << "```"; - ss4 << "\n```mermaid\n"; - ss4 << "flowchart LR\n"; - ss4 << "\tAAE[Two Module]\n"; - ss4 << "```"; - - REQUIRE(ss4.str() == threemodsbranched.str()); + std::stringstream ss4; + pluginplay::ModuleManager three_mods_branched; + three_mods_branched.add_module( + "One Module Submod Two Three"); + three_mods_branched.add_module("One Module"); + three_mods_branched.add_module("Two Module"); + three_mods_branched.change_submod("One Module Submod Two Three", + "Submodule 1", "One Module"); + three_mods_branched.change_submod("One Module Submod Two Three", + "Submodule 2", "Two Module"); + auto threemodsbranched = create_mermaid_graph(three_mods_branched); + + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAA[One Module]\n"; + ss4 << "```"; + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAB[One Module Submod Two Three]\n"; + ss4 << "\tAAB-->|Submodule 1| AAC[One Module]\n"; + ss4 << "\tAAB-->|Submodule 2| AAD[Two Module]\n"; + ss4 << "```"; + ss4 << "\n```mermaid\n"; + ss4 << "flowchart LR\n"; + ss4 << "\tAAE[Two Module]\n"; + ss4 << "```"; + + REQUIRE(ss4.str() == threemodsbranched.str()); } } From d611a1c1f784e204fb61668b7789e928cb375275 Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Thu, 13 Mar 2025 18:44:25 -0500 Subject: [PATCH 52/59] Apply suggestions from code review --- src/pluginplay/printing/mermaid.cpp | 8 ++++---- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index b7ff33858..318e322ca 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "module/module_class.hpp" -#include "module_manager/module_manager_class.hpp" -#include +#include +#include #include void add_letter(std::string& code) { + assert(code.size() == 2); for(int i = 2; i >= 0; --i) { if(code[i] == 'Z') { code[i] = 'A'; @@ -28,6 +28,7 @@ void add_letter(std::string& code) { return; } } + throw std::runtime_error("String is maxed out"); } void print_submods(const std::string module_key, @@ -44,7 +45,6 @@ void print_submods(const std::string module_key, if(value.has_module() == false) { add_letter(module_code); ss << module_code << "[No Submodule associated with Key]"; - continue; } else { add_letter(module_code); ss << module_code << "[" << value.get_name() << "]"; diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 36215c9a7..e48055f35 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -18,7 +18,6 @@ #include "../test_common.hpp" #include "catch2/catch_test_macros.hpp" #include "module/macros.hpp" -#include "module_manager/module_manager_class.hpp" #include "unit_testing_pts.hpp" #include #include From 3f712ee74ed5d85b89df7110948c94a9f9a7fe63 Mon Sep 17 00:00:00 2001 From: JacobH <91171563+jlheflin@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:28:42 -0500 Subject: [PATCH 53/59] remove ss.str() printing Co-authored-by: Ryan Richard --- src/pluginplay/printing/mermaid.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 318e322ca..83f770c03 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -70,6 +70,5 @@ std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm) { add_letter(module_code); } } - std::cout << ss.str(); return ss; } From 01208fa3856edb16d90c4d2bd962d001ff12a4cc Mon Sep 17 00:00:00 2001 From: JacobH <91171563+jlheflin@users.noreply.github.com> Date: Thu, 13 Mar 2025 22:29:43 -0500 Subject: [PATCH 54/59] unpdate include path Co-authored-by: Ryan Richard --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index e48055f35..f097311dc 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,7 +16,7 @@ #include "../catch.hpp" #include "../test_common.hpp" -#include "catch2/catch_test_macros.hpp" +#include #include "module/macros.hpp" #include "unit_testing_pts.hpp" #include From fa7422116bc17765dc84f66758d92b857572667b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 14 Mar 2025 03:30:39 +0000 Subject: [PATCH 55/59] Committing clang-format changes --- tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index f097311dc..191c3e91b 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,9 +16,9 @@ #include "../catch.hpp" #include "../test_common.hpp" -#include #include "module/macros.hpp" #include "unit_testing_pts.hpp" +#include #include #include #include From 1574ef4b5e610e7df0985c0e0a7341010637f6d1 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Thu, 13 Mar 2025 23:06:36 -0500 Subject: [PATCH 56/59] added functions to pluginplay::printing namespace --- include/pluginplay/printing/mermaid.hpp | 3 +++ include/pluginplay/printing/printing.hpp | 1 + src/pluginplay/printing/mermaid.cpp | 3 +++ .../unit_tests/pluginplay/printing/mermaid.cpp | 18 +++++++++++------- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/include/pluginplay/printing/mermaid.hpp b/include/pluginplay/printing/mermaid.hpp index 42adcfc87..1e7578abf 100644 --- a/include/pluginplay/printing/mermaid.hpp +++ b/include/pluginplay/printing/mermaid.hpp @@ -18,8 +18,11 @@ #include #include +namespace pluginplay::printing { + std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm); void print_submods(const std::string module_key, const pluginplay::ModuleManager& mm, std::stringstream& ss, std::string& module_code); +} // namespace pluginplay::printing diff --git a/include/pluginplay/printing/printing.hpp b/include/pluginplay/printing/printing.hpp index b35cb7fca..d571b5ecc 100644 --- a/include/pluginplay/printing/printing.hpp +++ b/include/pluginplay/printing/printing.hpp @@ -17,3 +17,4 @@ #pragma once #include #include +#include diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 83f770c03..9713f3a45 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -18,6 +18,8 @@ #include #include +namespace pluginplay::printing { + void add_letter(std::string& code) { assert(code.size() == 2); for(int i = 2; i >= 0; --i) { @@ -72,3 +74,4 @@ std::stringstream create_mermaid_graph(const pluginplay::ModuleManager& mm) { } return ss; } +} // namespace pluginplay::printing diff --git a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp index 191c3e91b..439a3bd2d 100644 --- a/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp +++ b/tests/cxx/unit_tests/pluginplay/printing/mermaid.cpp @@ -16,9 +16,9 @@ #include "../catch.hpp" #include "../test_common.hpp" -#include "module/macros.hpp" #include "unit_testing_pts.hpp" #include +#include #include #include #include @@ -61,14 +61,14 @@ inline MODULE_RUN(OneModuleSubTwoThree) { return results(); } TEST_CASE("Mermaid Graph") { SECTION("No Modules") { pluginplay::ModuleManager no_mods; - auto hello = create_mermaid_graph(no_mods); + auto hello = pluginplay::printing::create_mermaid_graph(no_mods); REQUIRE(hello.str() == "No modules are loaded, load some modules!"); } SECTION("One Module") { pluginplay::ModuleManager one_mod; one_mod.add_module("One Module"); - auto onemod = create_mermaid_graph(one_mod); + auto onemod = pluginplay::printing::create_mermaid_graph(one_mod); std::string val = "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; REQUIRE(val == onemod.str()); @@ -79,7 +79,8 @@ TEST_CASE("Mermaid Graph") { pluginplay::ModuleManager two_mods_unrelated; two_mods_unrelated.add_module("One Module"); two_mods_unrelated.add_module("Two Module"); - auto twomod = create_mermaid_graph(two_mods_unrelated); + auto twomod = + pluginplay::printing::create_mermaid_graph(two_mods_unrelated); ss << "\n```mermaid\nflowchart LR\n\tAAA[One Module]\n```"; ss << "\n```mermaid\nflowchart LR\n\tAAB[Two Module]\n```"; @@ -93,7 +94,8 @@ TEST_CASE("Mermaid Graph") { two_mods_related.add_module("Two Module"); two_mods_related.change_submod("One Module Submod Two", "Submodule", "Two Module"); - auto twomodrelated = create_mermaid_graph(two_mods_related); + auto twomodrelated = + pluginplay::printing::create_mermaid_graph(two_mods_related); ss2 << "\n```mermaid\nflowchart LR\n\tAAA[One Module Submod Two]\n"; ss2 << "\tAAA-->|Submodule| AAB[Two Module]\n```"; ss2 << "\n```mermaid\nflowchart LR\n\tAAC[Two Module]\n```"; @@ -112,7 +114,8 @@ TEST_CASE("Mermaid Graph") { "Two Module Submod Three"); three_mods_recursive.change_submod("Two Module Submod Three", "Submodule", "Three Module"); - auto threemodrecursive = create_mermaid_graph(three_mods_recursive); + auto threemodrecursive = + pluginplay::printing::create_mermaid_graph(three_mods_recursive); ss3 << "\n```mermaid\n"; ss3 << "flowchart LR\n"; ss3 << "\tAAA[One Module Submod Two]\n"; @@ -143,7 +146,8 @@ TEST_CASE("Mermaid Graph") { "Submodule 1", "One Module"); three_mods_branched.change_submod("One Module Submod Two Three", "Submodule 2", "Two Module"); - auto threemodsbranched = create_mermaid_graph(three_mods_branched); + auto threemodsbranched = + pluginplay::printing::create_mermaid_graph(three_mods_branched); ss4 << "\n```mermaid\n"; ss4 << "flowchart LR\n"; From 4de393d216000789c3b5c4a6d720af60f7c73c16 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 14 Mar 2025 00:09:18 -0500 Subject: [PATCH 57/59] fixed letter code issue --- src/pluginplay/printing/mermaid.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 9713f3a45..240bd81e3 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -21,7 +21,7 @@ namespace pluginplay::printing { void add_letter(std::string& code) { - assert(code.size() == 2); + assert(code.size() == 3); for(int i = 2; i >= 0; --i) { if(code[i] == 'Z') { code[i] = 'A'; From 4150c25227a2831a8c36bc9b2fdc71a46bd95245 Mon Sep 17 00:00:00 2001 From: Jacob Heflin Date: Fri, 14 Mar 2025 08:16:34 -0500 Subject: [PATCH 58/59] adjusted letter generation code --- src/pluginplay/printing/mermaid.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 240bd81e3..9ae5f51a6 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -21,8 +21,7 @@ namespace pluginplay::printing { void add_letter(std::string& code) { - assert(code.size() == 3); - for(int i = 2; i >= 0; --i) { + for(int i = (code.size() - 1); i >= 0; --i) { if(code[i] == 'Z') { code[i] = 'A'; } else { @@ -30,7 +29,6 @@ void add_letter(std::string& code) { return; } } - throw std::runtime_error("String is maxed out"); } void print_submods(const std::string module_key, From 423a6ba265505eef6a029ba7777f4c438d1333dd Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Fri, 14 Mar 2025 08:46:50 -0500 Subject: [PATCH 59/59] Update src/pluginplay/printing/mermaid.cpp --- src/pluginplay/printing/mermaid.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/pluginplay/printing/mermaid.cpp b/src/pluginplay/printing/mermaid.cpp index 9ae5f51a6..7a1e734ff 100644 --- a/src/pluginplay/printing/mermaid.cpp +++ b/src/pluginplay/printing/mermaid.cpp @@ -21,6 +21,7 @@ namespace pluginplay::printing { void add_letter(std::string& code) { + if(code.size() == 0) return; for(int i = (code.size() - 1); i >= 0; --i) { if(code[i] == 'Z') { code[i] = 'A';