r3944 - trunk/sfi



Author: timj
Date: 2006-10-07 17:02:27 -0400 (Sat, 07 Oct 2006)
New Revision: 3944

Added:
   trunk/sfi/sfitests.h
Modified:
   trunk/sfi/ChangeLog
   trunk/sfi/Makefile.am
Log:
Sat Oct  7 23:01:54 2006  Tim Janik  <timj gtk org>                                                                                                           
                                                                                                                                                              
        * sfitests.h: header file to be included by test programs.                                                                                            
                                                                                                                                                              



Modified: trunk/sfi/ChangeLog
===================================================================
--- trunk/sfi/ChangeLog	2006-10-07 19:33:21 UTC (rev 3943)
+++ trunk/sfi/ChangeLog	2006-10-07 21:02:27 UTC (rev 3944)
@@ -1,3 +1,7 @@
+Sat Oct  7 23:01:54 2006  Tim Janik  <timj gtk org>
+
+	* sfitests.h: header file to be included by test programs.
+
 Sat Oct  7 20:33:04 2006  Tim Janik  <timj gtk org>
 
 	* sfiwrapper.cc, sfiwrapper.h: provide integer types.

Modified: trunk/sfi/Makefile.am
===================================================================
--- trunk/sfi/Makefile.am	2006-10-07 19:33:21 UTC (rev 3943)
+++ trunk/sfi/Makefile.am	2006-10-07 21:02:27 UTC (rev 3944)
@@ -15,7 +15,7 @@
 	sfinote.h	sfiparams.h	sfiprimitives.h	sfiserial.h	\
 	sfitime.h	sfitypes.h	sfivalues.h	sfiustore.h	\
 	sficxx.hh	sfiring.h	sfimemory.h	sficomport.h	\
-	sfi.h								\
+	sfitests.h	sfi.h						\
 )
 sfi_all_sources = $(strip \
 	sfistore.c	sficomwire.c	sfifilecrawler.c \

Added: trunk/sfi/sfitests.h
===================================================================
--- trunk/sfi/sfitests.h	2006-10-07 19:33:21 UTC (rev 3943)
+++ trunk/sfi/sfitests.h	2006-10-07 21:02:27 UTC (rev 3944)
@@ -0,0 +1,60 @@
+/* SfiTests - Utilities for writing test programs
+ * Copyright (C) 2006 Tim Janik
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+#ifndef __SFI_TESTS_H__
+#define __SFI_TESTS_H__
+
+#include <sfi/sfi.h>
+#include <birnet/birnettests.h>
+
+/* --- test initialization --- */
+static void
+sfi_init_test (int          *argcp,
+	       char       ***argvp,
+	       SfiInitValue *nvalues)
+{
+  SfiInitValue empty_init_value = { NULL, };
+  if (!nvalues)
+    nvalues = &empty_init_value;
+  SfiInitValue jvalues[] = {
+    { "stand-alone", "true" },
+    { NULL }
+  };
+  guint i, j = 0, n = 0;
+  while (jvalues[j].value_name)
+    j++;
+  while (nvalues[n].value_name)
+    n++;
+  SfiInitValue *iv = g_new (SfiInitValue, j + n + 1);
+  for (i = 0; i < j; i++)
+    iv[i] = jvalues[i];
+  for (i = 0; i < n; i++)
+    iv[j + i] = nvalues[i];
+  iv[j + n] = empty_init_value;
+  sfi_init (argcp, argvp, NULL, iv);
+  g_free (iv);
+  unsigned int flags = g_log_set_always_fatal ((GLogLevelFlags) G_LOG_FATAL_MASK);
+  g_log_set_always_fatal ((GLogLevelFlags) (flags | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL));
+  g_printerr ("TEST: %s\n", g_get_prgname());
+  /* check NULL definition, especially for 64bit */
+  BIRNET_ASSERT (sizeof (NULL) == sizeof (void*));
+}
+
+#endif /* __SFI_TESTS_H__ */
+
+/* vim:set ts=8 sts=2 sw=2: */




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]