Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:57

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include <boost/test/tools/output_test_stream.hpp>
0010 #include <boost/test/unit_test.hpp>
0011 
0012 #include "Acts/Utilities/GraphViz.hpp"
0013 
0014 namespace Acts::Test {
0015 
0016 BOOST_AUTO_TEST_SUITE(GraphViz)
0017 
0018 BOOST_AUTO_TEST_CASE(ApiTest) {
0019   std::stringstream ss;
0020 
0021   using namespace Acts::GraphViz;
0022 
0023   Node node1{.id = "node1",
0024              .label = "Node 1",
0025              .shape = Shape::Ellipse,
0026              .style = {Style::Filled}};
0027 
0028   ss << node1;
0029 
0030   std::string exp = R"(node1 [label=<Node 1>, shape=ellipse, style=filled];
0031 )";
0032 
0033   BOOST_CHECK_EQUAL(ss.str(), exp);
0034 
0035   Node node2{.id = "node2",
0036              .label = "Node 2",
0037              .shape = Shape::Rectangle,
0038              .style = {Style::Dashed}};
0039 
0040   Edge edge = {.from = node1, .to = node2, .style = Style::Dashed};
0041 
0042   ss.str("");
0043 
0044   ss << edge;
0045 
0046   exp = R"(node1 -> node2 [style=dashed];
0047 )";
0048 
0049   BOOST_CHECK_EQUAL(ss.str(), exp);
0050 }
0051 
0052 BOOST_AUTO_TEST_SUITE_END()
0053 
0054 }  // namespace Acts::Test