about summary refs log tree commit diff
path: root/REORG.TODO/localedata/tests-mbwc/tsp_common.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
committerZack Weinberg <zackw@panix.com>2017-06-08 15:39:03 -0400
commit5046dbb4a7eba5eccfd258f92f4735c9ffc8d069 (patch)
tree4470480d904b65cf14ca524f96f79eca818c3eaf /REORG.TODO/localedata/tests-mbwc/tsp_common.c
parent199fc19d3aaaf57944ef036e15904febe877fc93 (diff)
downloadglibc-zack/build-layout-experiment.tar.gz
glibc-zack/build-layout-experiment.tar.xz
glibc-zack/build-layout-experiment.zip
Prepare for radical source tree reorganization. zack/build-layout-experiment
All top-level files and directories are moved into a temporary storage
directory, REORG.TODO, except for files that will certainly still
exist in their current form at top level when we're done (COPYING,
COPYING.LIB, LICENSES, NEWS, README), all old ChangeLog files (which
are moved to the new directory OldChangeLogs, instead), and the
generated file INSTALL (which is just deleted; in the new order, there
will be no generated files checked into version control).
Diffstat (limited to 'REORG.TODO/localedata/tests-mbwc/tsp_common.c')
-rw-r--r--REORG.TODO/localedata/tests-mbwc/tsp_common.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/REORG.TODO/localedata/tests-mbwc/tsp_common.c b/REORG.TODO/localedata/tests-mbwc/tsp_common.c
new file mode 100644
index 0000000000..cd88274c57
--- /dev/null
+++ b/REORG.TODO/localedata/tests-mbwc/tsp_common.c
@@ -0,0 +1,64 @@
+/*
+ *  TEST SUITE FOR MB/WC FUNCTIONS IN C LIBRARY
+ *  Main driver
+ */
+
+
+#define TST_FUNCTION_CALL(func) _TST_FUNCTION_CALL(func)
+#define _TST_FUNCTION_CALL(func) tst ##_## func
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <locale.h>
+#include <errno.h>
+#include <signal.h>
+
+#include "tst_types.h"
+#include "tgn_locdef.h"
+
+
+int
+main (int argc, char *argv[])
+{
+  int ret;
+  int debug;
+
+  debug = argc > 1 ? atoi (argv[1]) : 0;
+
+  if (debug)
+    {
+      fprintf (stdout, "\nTST_MBWC ===> %s ...\n", argv[0]);
+    }
+  ret = TST_FUNCTION_CALL (TST_FUNCTION) (stdout, debug);
+
+  return (ret != 0);
+}
+
+#define	 MAX_RESULT_REC	 132
+char result_rec[MAX_RESULT_REC];
+
+
+int
+result (FILE * fp, char res, const char *func, const char *loc, int rec_no,
+	int seq_no, int case_no, const char *msg)
+{
+  if (fp == NULL
+      || strlen (func) + strlen (loc) + strlen (msg) + 32 > MAX_RESULT_REC)
+    {
+      fprintf (stderr,
+	       "Warning: result(): can't write the result: %s:%s:%d:%d:%s\n",
+	       func, loc, rec_no, case_no, msg);
+      return 0;
+    }
+
+  sprintf (result_rec, "%s:%s:%d:%d:%d:%c:%s\n", func, loc, rec_no, seq_no,
+	   case_no, res, msg);
+
+  if (fputs (result_rec, fp) == EOF)
+    {
+      return 0;
+    }
+
+  return 1;
+}