Added doctest to thirdparty deps

This commit is contained in:
Bartek Kryza
2024-05-12 00:45:11 +02:00
parent ee3ae341d3
commit baeda78c7e
3 changed files with 7265 additions and 106 deletions

View File

@@ -16,8 +16,12 @@
* limitations under the License. * limitations under the License.
*/ */
TEST_CASE("t00002", "[test-case][class]") #include "../test_cases.h"
TEST_CASE("t00002")
{ {
using namespace clanguml::test;
auto [config, db] = load_config("t00002"); auto [config, db] = load_config("t00002");
auto diagram = config.diagrams["t00002_class"]; auto diagram = config.diagrams["t00002_class"];
@@ -35,6 +39,32 @@ TEST_CASE("t00002", "[test-case][class]")
REQUIRE(model->should_include({"clanguml", "t00002"}, "A")); REQUIRE(model->should_include({"clanguml", "t00002"}, "A"));
REQUIRE(!model->should_include({"std"}, "vector")); REQUIRE(!model->should_include({"std"}, "vector"));
CHECK_CLASS_DIAGRAM(
diagram, *model,
// Common test case for all diagram types
[](const auto &src) {
REQUIRE(!IsClass(src, "NOSUCHCLASS"));
REQUIRE(IsClass(src, "A"));
},
// Specific test case only for JSON diagram
[](const json_t &src) {
const auto &A = get_element(src, "A");
CHECK(A.has_value());
CHECK(A.value()["type"] == "class");
CHECK(A.value()["name"] == "A");
CHECK(A.value()["display_name"] == "A");
CHECK(A.value()["namespace"] == "clanguml::t00002");
CHECK(A.value()["source_location"]["file"] == "t00002.cc");
CHECK(A.value()["source_location"]["line"] == 7);
});
// auto src = render_class_diagram<plantuml_t>(diagram, *model);
/*
{ {
auto puml = generate_class_puml(diagram, *model); auto puml = generate_class_puml(diagram, *model);
AliasMatcher _A(puml); AliasMatcher _A(puml);
@@ -160,6 +190,8 @@ TEST_CASE("t00002", "[test-case][class]")
clanguml::util::get_git_commit()), clanguml::util::get_git_commit()),
"This is class B")); "This is class B"));
save_mermaid(config.output_directory(), diagram->name + ".mmd", mmd); save_mermaid(config.output_directory(), diagram->name + ".mmd",
mmd);
} }
*/
} }

21
thirdparty/doctest/LICENSE.txt vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016-2023 Viktor Kirilov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

7106
thirdparty/doctest/doctest.h vendored Normal file

File diff suppressed because it is too large Load Diff