ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
VolumeVisualizationTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file VolumeVisualizationTests.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 
18 #include "VisualizationTester.hpp"
20 
21 namespace Acts {
22 namespace Test {
23 
24 BOOST_AUTO_TEST_SUITE(Visualization)
25 
26 // Tests if the written obj output is well formatted
27 BOOST_AUTO_TEST_CASE(VolumeVisualizationObj) {
28  ObjVisualization obj;
29 
30  // Standard test
31  bool triangulate = false;
32  auto objTest = VolumeVisualization::test(obj, triangulate, "");
33  auto objErrors = testObjString(objTest, triangulate);
34  std::cout << "Volumes Obj Test : " << objTest.size()
35  << " characters written with " << objErrors.size() << " errors."
36  << std::endl;
37  BOOST_CHECK(objErrors.size() == 0);
38  for (auto objerr : objErrors) {
39  std::cout << objerr << std::endl;
40  }
41 
42  // Triangular mesh test
43  triangulate = true;
44  auto objTest3M = VolumeVisualization::test(obj, triangulate, "_3M");
45  auto objErrors3M = testObjString(objTest3M, triangulate);
46  std::cout << "Volumes Obj Test 3M : " << objTest3M.size()
47  << " characters written with " << objErrors3M.size() << " errors."
48  << std::endl;
49  BOOST_CHECK(objErrors3M.size() == 0);
50  for (auto objerr : objErrors3M) {
51  std::cout << objerr << std::endl;
52  }
53 }
54 
55 // Tests if the written ply output is well formatted
56 BOOST_AUTO_TEST_CASE(VolumeVisualizationPly) {
57  PlyVisualization ply;
58 
59  // Standard test
60  bool triangulate = false;
61  auto plyTest = VolumeVisualization::test(ply, triangulate, "");
62  auto plyErrors = testPlyString(plyTest, triangulate);
63  std::cout << "Volumes Ply Test : " << plyTest.size()
64  << " characters written with " << plyErrors.size() << " errors."
65  << std::endl;
66  BOOST_CHECK(plyErrors.size() == 0);
67  for (auto plyerr : plyErrors) {
68  std::cout << plyerr << std::endl;
69  }
70 
71  // Triangular mesh test
72  triangulate = true;
73  auto plyTest3M = VolumeVisualization::test(ply, triangulate, "_3M");
74  auto plyErrors3M = testPlyString(plyTest3M, triangulate);
75  std::cout << "Volumes Ply Test 3M : " << plyTest3M.size()
76  << " characters written with " << plyErrors3M.size() << " errors."
77  << std::endl;
78  BOOST_CHECK(plyErrors3M.size() == 0);
79  for (auto plyerr : plyErrors3M) {
80  std::cout << plyerr << std::endl;
81  }
82 }
83 
84 BOOST_AUTO_TEST_SUITE_END()
85 
86 } // namespace Test
87 } // namespace Acts