1 // Copyright (C) 2009-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <cppunit/BriefTestProgressListener.h>
21 #include <cppunit/CompilerOutputter.h>
22 #include <cppunit/extensions/TestFactoryRegistry.h>
23 #include <cppunit/TestResult.h>
24 #include <cppunit/TestResultCollector.h>
25 #include <cppunit/TestRunner.h>
26 #include <cppunit/XmlOutputter.h>
28 #include "test_unit.hxx"
30 #define TestUnit(call) display(#call); ier=call(nbargs,tabargs); display(ier)
32 static int total_tests = 0;
33 static int total_errors = 0;
34 static cpchar test_name = "Unknown";
36 static void display (cpchar name);
37 static void display (int ier);
39 // ============================================================== Main
40 int main (int nbargs, cpchar tabargs [])
46 TestUnit (test_sphere );
47 TestUnit (test_joint );
48 TestUnit (test_prism );
49 TestUnit (test_revolution9 );
50 TestUnit (test_revolution );
51 TestUnit (test_coude );
52 TestUnit (test_count );
53 TestUnit (test_decoupage );
54 // TestUnit (test_gen_xml );
55 // TestUnit (test_string_xml );
56 /// TestUnit (test_relecture );
57 TestUnit (test_spherical);
58 TestUnit (test_grille_cyl );
59 TestUnit (test_cylindrical );
60 TestUnit (test_cylinder );
61 // TestUnit (test_xml_cylinder );
62 TestUnit (test_pipe );
63 TestUnit (test_joint2 );
64 TestUnit (test_croix );
65 TestUnit (test_pipes );
66 TestUnit (test_lorraine);
67 TestUnit (test_disconnect2 );
68 TestUnit (test_disconnect4 );
69 TestUnit (test_disconnect1 );
70 TestUnit (test_disconnect3 );
71 TestUnit (test_disconnect );
72 TestUnit (test_transfo2 );
73 TestUnit (test_transfo );
74 TestUnit (test_copy_document );
75 TestUnit (test_cylindricals );
77 TestUnit (test_hexa_quads_5 );
78 TestUnit (test_hexa_quads_ab );
79 TestUnit (test_hexa_quads_ac );
80 TestUnit (test_hexa_quads_ace );
81 TestUnit (test_hexa_quads_acd );
82 TestUnit (test_hexa_quads_abcd );
83 TestUnit (test_hexa_quads_abce );
84 TestUnit (test_cramer );
85 TestUnit (test_hexa_quads_ac1 );
86 TestUnit (test_asso_grid );
87 TestUnit (test_piquage );
88 TestUnit (test_replace );
89 TestUnit (test_hemispheres );
93 cout << "========================================= "
95 cout << "==== End of tests : Number of Errors = " << total_errors << " / " << total_tests
97 cout << "========================================= "
100 return total_errors==0 ? 0 : 1;
103 // ============================================================== main-type
104 int main_standard (int argc, char* argv[])
106 // Retrieve test path from command line first argument. Default to "" which resolve
107 // to the top level suite.
108 std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
110 // Create the event manager and test controller
111 CPPUNIT_NS::TestResult controller;
113 // Add a listener that collects test result
114 CPPUNIT_NS::TestResultCollector result;
116 controller.addListener( &result );
118 // Add a listener that print dots as test run.
119 CPPUNIT_NS::BriefTestProgressListener progress;
121 controller.addListener( &progress );
123 // Add the top suite to the test runner
124 CPPUNIT_NS::TestRunner runner;
125 runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
126 runner.run( controller );
128 // Print test in a compiler compatible format.
129 CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
132 // Uncomment this for XML output
133 std::ofstream file( "cppunit-report.xml" );
135 CPPUNIT_NS::XmlOutputter xml( &result, file );
141 return result.wasSuccessful() ? 0 : 1;
143 // ============================================================= display name
144 void display (cpchar nom)
148 cout << "========================================= Run "
149 << test_name << endl;
151 // ============================================================= display ier
152 void display (int result)
154 cout << ".........................................."
155 << " End of " << test_name;
159 cout << ", Successfull";
162 cout << ", Code error = " << result;