summary refs log tree commit diff
path: root/localedata/tst-strptime.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-07-10 22:12:28 +0000
committerUlrich Drepper <drepper@redhat.com>2007-07-10 22:12:28 +0000
commit9ffe4385a8df731953e0857339ebc6dafea05570 (patch)
tree3b72e5cb2ebce3d2ff5beabdbed9014c9a532e1f /localedata/tst-strptime.c
parentcec5991f1316b81a8d8887f06affa6410c8db098 (diff)
downloadglibc-9ffe4385a8df731953e0857339ebc6dafea05570.tar.gz
glibc-9ffe4385a8df731953e0857339ebc6dafea05570.tar.xz
glibc-9ffe4385a8df731953e0857339ebc6dafea05570.zip
Test of greedy matching in strptime.
Diffstat (limited to 'localedata/tst-strptime.c')
-rw-r--r--localedata/tst-strptime.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/localedata/tst-strptime.c b/localedata/tst-strptime.c
new file mode 100644
index 0000000000..4ee4fcb78d
--- /dev/null
+++ b/localedata/tst-strptime.c
@@ -0,0 +1,23 @@
+#include <locale.h>
+#include <time.h>
+#include <stdio.h>
+
+static int
+do_test (void)
+{
+  if (setlocale (LC_ALL, "vi_VN.TCVN5712-1") == NULL)
+    {
+      puts ("cannot set locale");
+      return 1;
+    }
+  struct tm tm;
+  /* This is November in Vietnamese encoded using TCVN5712-1.  */
+  static const char s[] = "\
+\x54\x68\xb8\x6e\x67\x20\x6d\xad\xea\x69\x20\x6d\xe9\x74";
+  char *r = strptime (s, "%b", &tm);
+  printf ("r = %p, r-s = %ju, tm.tm_mon = %d\n", r, r - s, tm.tm_mon);
+  return r == NULL || r - s != 14 || tm.tm_mon != 10;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"