[223] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r401 - trunk/owl

daemon@ATHENA.MIT.EDU (nelhage@MIT.EDU)
Thu Oct 29 18:03:52 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
Date: Tue, 24 Oct 2006 13:42:00 -0400
To: dirty-owl-hackers@MIT.EDU
From: nelhage@MIT.EDU
Reply-To: dirty-owl-hackers@MIT.EDU

Author: nelhage
Date: 2006-10-24 13:41:59 -0400 (Tue, 24 Oct 2006)
New Revision: 401

Added:
   trunk/owl/test.h
Modified:
   trunk/owl/dict.c
   trunk/owl/util.c
   trunk/owl/variable.c
Log:
Test failures now print out file/line numbers

Modified: trunk/owl/dict.c
===================================================================
--- trunk/owl/dict.c	2006-10-24 16:40:02 UTC (rev 400)
+++ trunk/owl/dict.c	2006-10-24 17:41:59 UTC (rev 401)
@@ -143,7 +143,7 @@
 /************* REGRESSION TESTS **************/
 #ifdef OWL_INCLUDE_REG_TESTS
 
-#define FAIL_UNLESS(desc,pred) printf("\t%-4s: %s\n", (pred)?"ok":(numfailed++,"FAIL"), desc)
+#include "test.h"
 
 int owl_dict_regtest(void) {
   owl_dict d;

Added: trunk/owl/test.h
===================================================================
--- trunk/owl/test.h	                        (rev 0)
+++ trunk/owl/test.h	2006-10-24 17:41:59 UTC (rev 401)
@@ -0,0 +1,8 @@
+#ifndef __OWL_TEST_H__
+#define __OWL_TEST_H__
+
+#define FAIL_UNLESS(desc,pred) do { int __pred = (pred);                \
+    printf("\t%-4s: %s", (__pred)?"ok":(numfailed++,"FAIL"), desc);     \
+    if(!(__pred)) printf("\t(%s:%d)", __FILE__, __LINE__); printf("%c", '\n'); } while(0)
+
+#endif


Property changes on: trunk/owl/test.h
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/owl/util.c
===================================================================
--- trunk/owl/util.c	2006-10-24 16:40:02 UTC (rev 400)
+++ trunk/owl/util.c	2006-10-24 17:41:59 UTC (rev 401)
@@ -742,7 +742,7 @@
 
 #ifdef OWL_INCLUDE_REG_TESTS
 
-#define FAIL_UNLESS(desc,pred) printf("\t%-4s: %s\n", (pred)?"ok":(numfailed++,"FAIL"), desc)
+#include "test.h"
 
 int owl_util_regtest(void)
 {

Modified: trunk/owl/variable.c
===================================================================
--- trunk/owl/variable.c	2006-10-24 16:40:02 UTC (rev 400)
+++ trunk/owl/variable.c	2006-10-24 17:41:59 UTC (rev 401)
@@ -910,7 +910,7 @@
 
 #ifdef OWL_INCLUDE_REG_TESTS
 
-#define FAIL_UNLESS(desc,pred) printf("\t%-4s: %s\n", (pred)?"ok":(numfailed++,"FAIL"), desc)
+#include "test.h"
 
 int owl_variable_regtest(void) {
   owl_vardict vd;


home help back first fref pref prev next nref lref last post