source: icXML/icXML-devel/tests/src/UtilTests/CoreTestsMain.cpp @ 2733

Last change on this file since 2733 was 2733, checked in by cameron, 6 years ago

More path fixes.

File size: 8.2 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: CoreTestsMain.cpp 470088 2006-11-01 20:35:12Z amassari $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include "CoreTests.hpp"
27#include <icxercesc/util/PlatformUtils.hpp>
28
29
30
31// ---------------------------------------------------------------------------
32//  Externs for our testing methods. There is just one per file so a header
33//  for each one is a little overkill, so we just do it the old fashioned way.
34// ---------------------------------------------------------------------------
35extern bool testTranscoders();
36extern bool testCountedPointer();
37extern bool testBitSet();
38extern bool testRefArray();
39extern bool testRefHashTable();
40extern bool testRefStack();
41extern bool testRefVector();
42extern bool testString();
43extern bool testURL();
44extern bool testValueArray();
45extern bool testValueStack();
46extern bool testValueVector();
47
48
49int main()
50{
51    // Do the platform initialization
52    try
53    {
54        XMLPlatformUtils::Initialize();
55    }
56
57    catch(const XMLException& toCatch)
58    {
59        XERCES_STD_QUALIFIER wcout << L"Parser Init Failed!\n   INFO: ("
60                   << toCatch.getSrcFile() << L"." << toCatch.getSrcLine()
61                   << L") -" << toCatch.getMessage() << XERCES_STD_QUALIFIER endl;
62        return 0xFFFF;
63    }
64
65    XERCES_STD_QUALIFIER wcout << L"\nXML4C2 Core Utilities Unit Tester\n" << XERCES_STD_QUALIFIER endl;
66
67    // This value will return the number of failed tests
68    int retVal = 0;
69
70
71    try
72    {
73        // -------------------------------------------------------------------
74        // Test the basic transcoding services
75        // -------------------------------------------------------------------
76        if (!testTranscoders())
77        {
78            XERCES_STD_QUALIFIER wcout << L"Transcoder tests failed" << XERCES_STD_QUALIFIER endl;
79            retVal++;
80        }
81        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
82
83
84        // -------------------------------------------------------------------
85        // Test the String class
86        // -------------------------------------------------------------------
87        if (!testString())
88        {
89            XERCES_STD_QUALIFIER wcout << L"String tests failed" << XERCES_STD_QUALIFIER endl;
90            retVal++;
91        }
92        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
93
94
95        // -------------------------------------------------------------------
96        // Test the CountedPointerTo template class
97        // -------------------------------------------------------------------
98        if (!testCountedPointer())
99        {
100            XERCES_STD_QUALIFIER wcout << L"CountedPointerTo tests failed" << XERCES_STD_QUALIFIER endl;
101            retVal++;
102        }
103        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
104
105
106        // -------------------------------------------------------------------
107        // Test the URL class
108        // -------------------------------------------------------------------
109        if (!testURL())
110        {
111            XERCES_STD_QUALIFIER wcout << L"URL tests failed" << XERCES_STD_QUALIFIER endl;
112            retVal++;
113        }
114        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
115
116
117        // -------------------------------------------------------------------
118        // Test the ValueVectorOf template class
119        // -------------------------------------------------------------------
120        if (!testValueVector())
121        {
122            XERCES_STD_QUALIFIER wcout << L"ValueVectorOf tests failed" << XERCES_STD_QUALIFIER endl;
123            retVal++;
124        }
125        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
126
127
128        // -------------------------------------------------------------------
129        // Test the ValueArrayOf template class
130        // -------------------------------------------------------------------
131        if (!testValueArray())
132        {
133            XERCES_STD_QUALIFIER wcout << L"ValueArrayOf tests failed" << XERCES_STD_QUALIFIER endl;
134            retVal++;
135        }
136        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
137
138
139        // -------------------------------------------------------------------
140        // Test the ValueStackOf template class
141        // -------------------------------------------------------------------
142        if (!testValueStack())
143        {
144            XERCES_STD_QUALIFIER wcout << L"ValueStackOf tests failed" << XERCES_STD_QUALIFIER endl;
145            retVal++;
146        }
147        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
148
149
150        // -------------------------------------------------------------------
151        // Test the RefArrayOf template class
152        // -------------------------------------------------------------------
153        if (!testRefArray())
154        {
155            XERCES_STD_QUALIFIER wcout << L"RefArrayOf tests failed" << XERCES_STD_QUALIFIER endl;
156            retVal++;
157        }
158        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
159
160
161        // -------------------------------------------------------------------
162        // Test the RefStackOf template class
163        // -------------------------------------------------------------------
164        if (!testRefStack())
165        {
166            XERCES_STD_QUALIFIER wcout << L"RefStackOf tests failed" << XERCES_STD_QUALIFIER endl;
167            retVal++;
168        }
169        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
170
171
172        // -------------------------------------------------------------------
173        // Test the RefVectorOf template class
174        // -------------------------------------------------------------------
175        if (!testRefVector())
176        {
177            XERCES_STD_QUALIFIER wcout << L"RefVectorOf tests failed" << XERCES_STD_QUALIFIER endl;
178            retVal++;
179        }
180        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
181
182
183        // -------------------------------------------------------------------
184        // Test the RefHashtableOf template class
185        // -------------------------------------------------------------------
186        if (!testRefHashTable())
187        {
188            XERCES_STD_QUALIFIER wcout << L"RefHashTableOf tests failed" << XERCES_STD_QUALIFIER endl;
189            retVal++;
190        }
191        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
192
193
194        // -------------------------------------------------------------------
195        // Test the BitSet class
196        // -------------------------------------------------------------------
197        if (!testBitSet())
198        {
199            XERCES_STD_QUALIFIER wcout << L"BitSet tests failed" << XERCES_STD_QUALIFIER endl;
200            retVal++;
201        }
202        XERCES_STD_QUALIFIER wcout << XERCES_STD_QUALIFIER endl;
203    }
204
205    catch(const XMLException& toCatch)
206    {
207        XERCES_STD_QUALIFIER wcout  << L"Exception During Test!\n   INFO: ("
208                    << toCatch.getSrcFile() << L"."
209                    << toCatch.getSrcLine() << L") -"
210                    << toCatch.getMessage() << XERCES_STD_QUALIFIER endl;
211        return 0xFFFF;
212    }
213
214    // If we failed any tests, display a message
215    XERCES_STD_QUALIFIER wcout << L"--------------------------------\n";
216    if (retVal == 0)
217        XERCES_STD_QUALIFIER wcout << L"<<PASSED>>: All tests passed\n";
218    else
219        XERCES_STD_QUALIFIER wcout << L"<<FAILED>>: Some tests failed\n";
220    XERCES_STD_QUALIFIER wcout << L"--------------------------------\n" << XERCES_STD_QUALIFIER endl;
221
222    return retVal;
223}
Note: See TracBrowser for help on using the repository browser.