aboutsummaryrefslogtreecommitdiff
path: root/dejagnu.h
diff options
context:
space:
mode:
authorRob Savoye <rob@welcomehome.org>2001-05-30 15:35:50 +0000
committerRob Savoye <rob@welcomehome.org>2001-05-30 15:35:50 +0000
commit682f43d2645995ccfef6c84beaf7f1aea69d1875 (patch)
treedabde2872c7fb3f7c7b10321bbcf4dc9765b63f0 /dejagnu.h
parent4330bafff46c45742dc65b79a7e06196f0d89336 (diff)
downloaddejagnu-682f43d2645995ccfef6c84beaf7f1aea69d1875.zip
dejagnu-682f43d2645995ccfef6c84beaf7f1aea69d1875.tar.gz
dejagnu-682f43d2645995ccfef6c84beaf7f1aea69d1875.tar.bz2
* acinclude.m4(DJ_AC_STL): Also use
AC_LANG_CPLUSPLUS so we build this test case with G++. * aclocal.m4, configure: Regenerated. * dejagnu.h: Don't use testout(), have each method print the array value directly, which is much simpler. * acinclude.m4(DJ_AC_STL): s/for for/for/. * dejagnu.h: Add conditional support for sstream. (testout): Likewise. Make return type `const'.
Diffstat (limited to 'dejagnu.h')
-rw-r--r--dejagnu.h23
1 files changed, 8 insertions, 15 deletions
diff --git a/dejagnu.h b/dejagnu.h
index 9d51c47..a2653f7 100644
--- a/dejagnu.h
+++ b/dejagnu.h
@@ -68,7 +68,11 @@ totals (void) {
#include <iomanip>
#include <fstream>
#include <string>
+#if HAVE_STL3
+#include <sstream>
+#else
#include <strstream>
+#endif
char *outstate[] = {
"FAILED: ",
@@ -110,16 +114,6 @@ OMANIP<int> testout(int i) {
}
#endif
-char *testout (int x) {
- using namespace std;
- const int len = 128;
- static char buf[len];
- static ostrstream oss(buf, len, ios::out);
- oss.seekp(ios::beg);
- oss << outstate[x] << ends;
- return buf;
-}
-
enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
class TestState {
@@ -137,7 +131,6 @@ class TestState {
totals();
};
-
void testrun (bool b, std::string s) {
if (b)
pass (s);
@@ -149,7 +142,7 @@ class TestState {
passed++;
laststate = PASSED;
lastmsg = s;
- std::cout << "\t" << testout(PASSED) << s << std::endl;
+ std::cout << "\t" << outstate[PASSED] << s << std::endl;
}
void pass (const char *c) {
std::string s = c;
@@ -160,7 +153,7 @@ class TestState {
failed++;
laststate = FAILED;
lastmsg = s;
- std::cout << "\t" << testout(FAILED) << s << std::endl;
+ std::cout << "\t" << outstate[FAILED] << s << std::endl;
}
void fail (const char *c) {
std::string s = c;
@@ -171,7 +164,7 @@ class TestState {
untest++;
laststate = UNTESTED;
lastmsg = s;
- std::cout << "\t" << testout(UNTESTED) << s << std::endl;
+ std::cout << "\t" << outstate[UNTESTED] << s << std::endl;
}
void untested (const char *c) {
std::string s = c;
@@ -182,7 +175,7 @@ class TestState {
unresolve++;
laststate = UNRESOLVED;
lastmsg = s;
- std::cout << "\t" << testout(UNRESOLVED) << s << std::endl;
+ std::cout << "\t" << outstate[UNRESOLVED] << s << std::endl;
}
void unresolved (const char *c) {
std::string s = c;