Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-07 09:17:31

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 using namespace Acts;
0015 
0016 namespace ActsTests {
0017 
0018 BOOST_AUTO_TEST_SUITE(UtilitiesSuite)
0019 
0020 BOOST_AUTO_TEST_CASE(ApiTest) {
0021   std::stringstream ss;
0022 
0023   using namespace GraphViz;
0024 
0025   Node node1{.id = "node1",
0026              .label = "Node 1",
0027              .shape = Shape::Ellipse,
0028              .style = {Style::Filled}};
0029 
0030   ss << node1;
0031 
0032   std::string exp = R"(node1 [label=<Node 1>, shape=ellipse, style=filled];
0033 )";
0034 
0035   BOOST_CHECK_EQUAL(ss.str(), exp);
0036 
0037   Node node2{.id = "node2",
0038              .label = "Node 2",
0039              .shape = Shape::Rectangle,
0040              .style = {Style::Dashed}};
0041 
0042   Edge edge = {.from = node1, .to = node2, .style = Style::Dashed};
0043 
0044   ss.str("");
0045 
0046   ss << edge;
0047 
0048   exp = R"("node1" -> "node2" [style=dashed];
0049 )";
0050 
0051   BOOST_CHECK_EQUAL(ss.str(), exp);
0052 }
0053 
0054 BOOST_AUTO_TEST_SUITE_END()
0055 
0056 }  // namespace ActsTests