From 682f43d2645995ccfef6c84beaf7f1aea69d1875 Mon Sep 17 00:00:00 2001 From: Rob Savoye Date: Wed, 30 May 2001 15:35:50 +0000 Subject: * 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'. --- dejagnu.h | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) (limited to 'dejagnu.h') 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 #include #include +#if HAVE_STL3 +#include +#else #include +#endif char *outstate[] = { "FAILED: ", @@ -110,16 +114,6 @@ OMANIP 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; -- cgit v1.1