1 // BEGIN_COPYRIGHT -*- glean -*-
3 // Copyright (C) 1999 Allen Akin All Rights Reserved.
5 // Permission is hereby granted, free of charge, to any person
6 // obtaining a copy of this software and associated documentation
7 // files (the "Software"), to deal in the Software without
8 // restriction, including without limitation the rights to use,
9 // copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the
11 // Software is furnished to do so, subject to the following
14 // The above copyright notice and this permission notice shall be
15 // included in all copies or substantial portions of the
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 // KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 // WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
21 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL ALLEN AKIN BE
22 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 // OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
32 // test.cpp: implementation of base class for tests
48 ///////////////////////////////////////////////////////////////////////////////
49 // Class variables for automatic construction of list of all tests
50 ///////////////////////////////////////////////////////////////////////////////
51 Test
* Test::testList
; // Guaranteed initialized to zero at startup,
52 // before any constructors are invoked.
53 // (See discussion in section 10.4.9,
54 // page 252, of ``C++ Programming Language''
57 int Test::testCount
; // Also initialized to zero.
59 ///////////////////////////////////////////////////////////////////////////////
60 // Constructor/Destructor:
61 ///////////////////////////////////////////////////////////////////////////////
62 Test::Test(const char* testName
, const char *descrip
):
63 name(testName
), description(descrip
) {
71 Test::Test(const char* testName
, const char *descrip
, Test
** thePrereqs
):
72 name(testName
), description(descrip
) {
83 ///////////////////////////////////////////////////////////////////////////////
84 // Stream opening utilities for results databases
85 ///////////////////////////////////////////////////////////////////////////////
87 Test::OutputStream::OutputStream(Test
& t
) {
88 s
= new ofstream(t
.env
->resultFileName(t
.name
).c_str());
90 throw Test::CantOpenResultsFile(t
.name
, t
.env
->options
.db1Name
);
91 } // Test::OutputStream::OutputStream
93 Test::OutputStream::~OutputStream() {
96 } // Test::OutputStream::~OutputStream
98 Test::OutputStream::operator ofstream
& () {
100 } // Test::OutputStream::operator ::ofstream&
102 Test::Input1Stream::Input1Stream(Test
& t
) {
103 s
= new ifstream(t
.env
->resultFileName(
104 t
.env
->options
.db1Name
, t
.name
).c_str());
106 throw Test::CantOpenResultsFile(t
.name
, t
.env
->options
.db1Name
);
107 } // Test::Input1Stream::Input1Stream
109 Test::Input1Stream::~Input1Stream() {
112 } // Test::Input1Stream::~Input1Stream
114 Test::Input1Stream::operator ifstream
& () {
116 } // Test::Input1Stream::operator ::ifstream&
118 Test::Input2Stream::Input2Stream(Test
& t
) {
119 s
= new ifstream(t
.env
->resultFileName(
120 t
.env
->options
.db2Name
, t
.name
).c_str());
122 throw Test::CantOpenResultsFile(t
.name
, t
.env
->options
.db2Name
);
123 } // Test::Input2Stream::Input2Stream
125 Test::Input2Stream::~Input2Stream() {
128 } // Test::Input2Stream::~Input2Stream
130 Test::Input2Stream::operator ifstream
& () {
132 } // Test::Input2Stream::operator ::ifstream&