Skip to content

Commit

Permalink
Test of greedy matching in strptime.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulrich Drepper committed Jul 10, 2007
1 parent cec5991 commit 9ffe438
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions localedata/tst-strptime.c
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 9ffe438

Please sign in to comment.