/[dejagnu]/dejagnu/dejagnu.h
ViewVC logotype

Diff of /dejagnu/dejagnu.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.7 by rsavoye, Thu Nov 1 04:14:19 2001 UTC revision 1.8 by rsavoye, Thu Jun 6 15:31:13 2002 UTC
# Line 1  Line 1 
1  /*  /*
2   *   Copyright (C) 2000, 2001 Free Software Foundation, Inc.   *   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
3   *   *
4   * This program is free software; you can redistribute it and/or modify   * This program is free software; you can redistribute it and/or modify
5   * it under the terms of the GNU General Public License as published by   * it under the terms of the GNU General Public License as published by
# Line 20  Line 20 
20  #define __DEJAGNU_H__  #define __DEJAGNU_H__
21    
22  #include <stdio.h>  #include <stdio.h>
23    #include <stdarg.h>
24    #include <string.h>
25    
26    /* If you have problems with dejagnu dropping failed, untested, or
27     * unresolved messages generated by a unit testcase,
28     */
29    
30    /* #define _DEJAGNU_WAIT_
31     */
32    
33    #ifdef _DEJAGNU_WAIT_
34    #      include <sys/time.h>
35    #      include <sys/types.h>
36    #      include <unistd.h>
37    #endif
38    
39    #define _BUFFER_SIZE_ 512
40    
41  static int passed;  static int passed;
42  static int failed;  static int failed;
43  static int untest;  static int untest;
44  static int unresolve;  static int unresolve;
45    
46    static char buffer[ _BUFFER_SIZE_ ];
47    
48    #ifdef _DEJAGNU_WAIT_
49    void
50    wait(void) {
51           fd_set rfds;
52           struct timeval tv;
53    
54           FD_ZERO(&rfds);
55           tv.tv_sec = 0;
56           tv.tv_usec = 1;
57    
58           select(0, &rfds, NULL, NULL, &tv);
59    }
60    #endif
61    
62  inline void  inline void
63  pass (const char *s) {  pass (const char* fmt, ... ) {
64            va_list ap;
65            
66      passed++;      passed++;
67      printf ("\tPASSED: %s\n", s);          va_start( ap, fmt );
68            vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
69            va_end( ap );
70        printf ("\tPASSED: %s\n", buffer );
71    #ifdef _DEJAGNU_WAIT_
72           wait();
73    #endif
74  }  }
75    
76  inline void  inline void
77  fail (const char *s) {  fail (const char* fmt, ... ) {
78            va_list ap;
79    
80      failed++;      failed++;
81      printf ("\tFAILED: %s\n", s);          va_start( ap, fmt );
82            vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
83            va_end( ap );
84        printf ("\tFAILED: %s\n", buffer );
85    #ifdef _DEJAGNU_WAIT_
86           wait();
87    #endif
88  }  }
89    
90  inline void  inline void
91  untested (const char *s) {  untested (const char* fmt, ... ) {
92            va_list ap;
93    
94      untest++;      untest++;
95      printf ("\tUNTESTED: %s\n", s);          va_start( ap, fmt );
96            vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
97            va_end( ap );
98        printf ("\tUNTESTED: %s\n", buffer );
99    #ifdef _DEJAGNU_WAIT_
100           wait();
101    #endif
102  }  }
103    
104  inline void  inline void
105  unresolved (const char *s) {  unresolved (const char* fmt, ... ) {
106            va_list ap;
107    
108      unresolve++;      unresolve++;
109      printf ("\tUNRESOLVED: %s\n", s);          va_start( ap, fmt );
110            vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
111            va_end( ap );
112        printf ("\tUNRESOLVED: %s\n", buffer );
113    #ifdef _DEJAGNU_WAIT_
114           wait();
115    #endif
116    }
117    
118    inline void
119    note (const char* fmt, ... ) {
120            va_list ap;
121    
122            va_start( ap, fmt );
123            vsnprintf( buffer, _BUFFER_SIZE_, fmt, ap );
124            va_end( ap );
125        printf ("\tNOTE: %s\n", buffer );
126    #ifdef _DEJAGNU_WAIT_
127           wait();
128    #endif
129  }  }
130    
131  inline void  inline void
# Line 58  totals (void) { Line 136  totals (void) {
136      if (untest)      if (untest)
137          printf ("\t#untested:\t\t%d\n", untest);          printf ("\t#untested:\t\t%d\n", untest);
138      if (unresolve)      if (unresolve)
139          printf ("\t#unresolved:\t\t%d\n", unresolve);          printf ("\t#unresolved:\t\t%d\n", unresolved);
140  }  }
141    
142  #ifdef __cplusplus  #ifdef __cplusplus

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.8

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26