about summary refs log tree commit diff
path: root/localedata/tests-mbwc/tst_strcoll.c
diff options
context:
space:
mode:
authorAndreas Jaeger <aj@suse.de>2000-06-29 07:13:12 +0000
committerAndreas Jaeger <aj@suse.de>2000-06-29 07:13:12 +0000
commit2e23c3cc3fede8cc080af74f1b4f124b12955138 (patch)
tree40f76b9203246a3e70247b56743b442313179732 /localedata/tests-mbwc/tst_strcoll.c
parent4eeccd750dce53d7b168d227cb5cfcf70d674310 (diff)
downloadglibc-2e23c3cc3fede8cc080af74f1b4f124b12955138.tar.gz
glibc-2e23c3cc3fede8cc080af74f1b4f124b12955138.tar.xz
glibc-2e23c3cc3fede8cc080af74f1b4f124b12955138.zip
Update.
2000-06-29  Andreas Jaeger  <aj@suse.de>

	* Makefile (locale_test_suite): Add new test files.
	(tst_mblen-ENV): New.
	(tst_mbtowc-ENV): New.
	(tst_strcoll-ENV): New.
	(tst_strxfrm-ENV): New.
	(tst_wctomb-ENV): New.

	* tests-mbwc/tst_wctomb.c: New test file from Shoji Kuwabara
	<kuwahara@cthulhu.engr.sgi.com>.
	* tests-mbwc/dat_wctomb.c: Likewise.
	* tests-mbwc/tst_mbtowc.c: Likewise.
	* tests-mbwc/dat_mbtowc.c: Likewise.
	* tests-mbwc/tst_strxfrm.c: Likewise.
	* tests-mbwc/dat_strxfrm.c: Likewise.
	* tests-mbwc/dat_strcoll.c: Likewise.
	* tests-mbwc/tst_strcoll.c: Likewise.
	* tests-mbwc/tst_mblen.c: Likewise.
	* tests-mbwc/dat_mblen.c: Likewise.
Diffstat (limited to 'localedata/tests-mbwc/tst_strcoll.c')
-rw-r--r--localedata/tests-mbwc/tst_strcoll.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/localedata/tests-mbwc/tst_strcoll.c b/localedata/tests-mbwc/tst_strcoll.c
new file mode 100644
index 0000000000..4c5a84f697
--- /dev/null
+++ b/localedata/tests-mbwc/tst_strcoll.c
@@ -0,0 +1,87 @@
+/*
+  STRCOLL: int strcoll (const char *s1, const char *s2)
+*/
+
+#define TST_FUNCTION strcoll
+
+#include "tsp_common.c"
+#include "dat_strcoll.c"
+
+int
+tst_strcoll (FILE * fp, int debug_flg)
+{
+  TST_DECL_VARS (int);
+  const char *s1, *s2;
+
+  TST_DO_TEST (strcoll)
+  {
+    TST_HEAD_LOCALE (strcoll, S_STRCOLL);
+    TST_DO_REC (strcoll)
+    {
+      TST_GET_ERRET (strcoll);
+      s1 = TST_INPUT (strcoll).s1;
+      s2 = TST_INPUT (strcoll).s2;
+
+      TST_CLEAR_ERRNO;
+      ret = strcoll (s1, s2);
+      TST_SAVE_ERRNO;
+
+      if (debug_flg)
+	{
+	  fprintf (stdout, "strcoll() [ %s : %d ] ret = %d\n", locale,
+		   rec + 1, ret);
+	  fprintf (stdout, "			    errno = %d\n",
+		   errno_save);
+	  fprintf (stdout, "			    LC_COLLATE = %s\n",
+		   (setlocale (LC_COLLATE, NULL)) ? setlocale (LC_COLLATE,
+							       NULL) : "");
+	}
+
+      TST_IF_RETURN (S_STRCOLL)
+      {
+	if (ret_exp == +1)
+	  {
+	    if (ret > 0)
+	      {
+		Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_STRCOLL, CASE_3,
+			"the return value should be greater than 0,"
+			" but is not ...");
+	      }
+	  }
+	else if (ret_exp == -1)
+	  {
+	    if (ret < 0)
+	      {
+		Result (C_SUCCESS, S_STRCOLL, CASE_3, MS_PASSED);
+	      }
+	    else
+	      {
+		err_count++;
+		Result (C_FAILURE, S_STRCOLL, CASE_3,
+			"the return value should less than 0, but not ...");
+	      }
+	  }
+	else if (ret_exp != 0)
+	  {
+	    if (debug_flg)
+	      {
+		fprintf (stderr, "*** Warning *** : tst_strcoll : "
+			 "(check the test data); should set ret_flg=1"
+			 " to check a return value");
+	      }
+
+	    warn_count++;
+	    Result (C_INVALID, S_WCSCHR, CASE_3, "(check the test data); "
+		    "should set ret_flg=1 to check a return value");
+	  }
+      }
+    }
+  }
+
+  return err_count;
+}