ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SurfaceVisualizationTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file SurfaceVisualizationTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/tools/output_test_stream.hpp>
10 #include <boost/test/unit_test.hpp>
11 
12 #include <fstream>
13 #include <iostream>
14 
19 #include "VisualizationTester.hpp"
20 
21 namespace Acts {
22 namespace Test {
23 
24 BOOST_AUTO_TEST_SUITE(Visualization)
25 
26 
27 BOOST_AUTO_TEST_CASE(SurfaceVisualizationObj) {
28  ObjVisualization obj;
29  // Standard test
30  bool triangulate = false;
31  auto objTest = SurfaceVisualization::test(obj, triangulate, "");
32  auto objErrors = testObjString(objTest, triangulate);
33  std::cout << "Sufaces Obj Test : " << objTest.size()
34  << " characters written with " << objErrors.size() << " errors."
35  << std::endl;
36  BOOST_CHECK(objErrors.size() == 0);
37  for (auto objerr : objErrors) {
38  std::cout << objerr << std::endl;
39  }
40  // Triangular mesh test
41  triangulate = true;
42  auto objTest3M = SurfaceVisualization::test(obj, triangulate, "_3M");
43  auto objErrors3M = testObjString(objTest3M, triangulate);
44  std::cout << "Sufaces Obj Test 3M : " << objTest3M.size()
45  << " characters written with " << objErrors3M.size() << " errors."
46  << std::endl;
47  BOOST_CHECK(objErrors3M.size() == 0);
48  for (auto objerr : objErrors3M) {
49  std::cout << objerr << std::endl;
50  }
51 }
52 
54 BOOST_AUTO_TEST_CASE(SurfaceVisualizationPly) {
55  PlyVisualization ply;
56  // Standard test
57  bool triangulate = false;
58  auto plyTest = SurfaceVisualization::test(ply, triangulate, "");
59  auto plyErrors = testPlyString(plyTest, triangulate);
60  std::cout << "Sufaces Ply Test : " << plyTest.size()
61  << " characters written with " << plyErrors.size() << " errors."
62  << std::endl;
63  BOOST_CHECK(plyErrors.size() == 0);
64  for (auto plyerr : plyErrors) {
65  std::cout << plyerr << std::endl;
66  }
67  // Triangular mesh test
68  triangulate = true;
69  auto plyTest3M = SurfaceVisualization::test(ply, triangulate, "_3M");
70  auto plyErrors3M = testPlyString(plyTest3M, triangulate);
71  std::cout << "Sufaces Ply Test 3M : " << plyTest3M.size()
72  << " characters written with " << plyErrors3M.size() << " errors."
73  << std::endl;
74  BOOST_CHECK(plyErrors3M.size() == 0);
75  for (auto plyerr : plyErrors3M) {
76  std::cout << plyerr << std::endl;
77  }
78 }
79 
80 BOOST_AUTO_TEST_SUITE_END()
81 
82 } // namespace Test
83 } // namespace Acts