aboutsummaryrefslogtreecommitdiff
path: root/dejagnu.h
diff options
context:
space:
mode:
Diffstat (limited to 'dejagnu.h')
-rw-r--r--dejagnu.h47
1 files changed, 17 insertions, 30 deletions
diff --git a/dejagnu.h b/dejagnu.h
index 4240197..63f135c 100644
--- a/dejagnu.h
+++ b/dejagnu.h
@@ -1,5 +1,6 @@
-/* Dejagnu unit testing header.
- Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
+/* DejaGnu unit testing header.
+ Copyright (C) 2000, 2001, 2002, 2004, 2006 Free Software
+ Foundation, Inc.
This file is part of DejaGnu.
@@ -25,31 +26,27 @@ Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#include <string.h>
/* If you have problems with DejaGnu dropping failed, untested, or
- * unresolved messages generated by a unit testcase,
- */
+ * unresolved messages generated by a unit testcase, then: */
-/* #define _DEJAGNU_WAIT_
- */
+/* #define _DEJAGNU_WAIT_ */
#ifdef _DEJAGNU_WAIT_
-# include <sys/time.h>
-# include <sys/types.h>
-# include <unistd.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
#endif
-#define _BUFFER_SIZE_ 512
-
static int passed;
static int failed;
static int untest;
static int unresolve;
-static char buffer[ _BUFFER_SIZE_ ];
+static char buffer[512];
-#ifdef _DEJAGNU_WAIT_
void
wait (void)
{
+#ifdef _DEJAGNU_WAIT_
fd_set rfds;
struct timeval tv;
@@ -58,8 +55,8 @@ wait (void)
tv.tv_usec = 1;
select (0, &rfds, NULL, NULL, &tv);
-}
#endif
+}
inline void
pass (const char* fmt, ...)
@@ -68,12 +65,10 @@ pass (const char* fmt, ...)
passed++;
va_start (ap, fmt);
- vsnprintf (buffer, _BUFFER_SIZE_, fmt, ap);
+ vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
printf ("\tPASSED: %s\n", buffer);
-#ifdef _DEJAGNU_WAIT_
wait ();
-#endif
}
inline void
@@ -83,12 +78,10 @@ fail (const char* fmt, ...)
failed++;
va_start (ap, fmt);
- vsnprintf (buffer, _BUFFER_SIZE_, fmt, ap);
+ vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
printf ("\tFAILED: %s\n", buffer);
-#ifdef _DEJAGNU_WAIT_
wait ();
-#endif
}
inline void
@@ -98,12 +91,10 @@ untested (const char* fmt, ...)
untest++;
va_start (ap, fmt);
- vsnprintf (buffer, _BUFFER_SIZE_, fmt, ap);
+ vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
printf ("\tUNTESTED: %s\n", buffer);
-#ifdef _DEJAGNU_WAIT_
wait ();
-#endif
}
inline void
@@ -113,12 +104,10 @@ unresolved (const char* fmt, ...)
unresolve++;
va_start (ap, fmt);
- vsnprintf (buffer, _BUFFER_SIZE_, fmt, ap);
+ vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
printf ("\tUNRESOLVED: %s\n", buffer);
-#ifdef _DEJAGNU_WAIT_
wait ();
-#endif
}
inline void
@@ -127,12 +116,10 @@ note (const char* fmt, ...)
va_list ap;
va_start (ap, fmt);
- vsnprintf (buffer, _BUFFER_SIZE_, fmt, ap);
+ vsnprintf (buffer, sizeof (buffer), fmt, ap);
va_end (ap);
printf ("\tNOTE: %s\n", buffer);
-#ifdef _DEJAGNU_WAIT_
wait ();
-#endif
}
inline void
@@ -160,7 +147,7 @@ const char *outstate_list[] = {
const char ** outstate = outstate_list;
-enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
+enum teststate { FAILED, PASSED, UNTESTED, UNRESOLVED} laststate;
class TestState {
private: