mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-24 10:57:53 +02:00
build
debian
docs
gio
glib
gmodule
gobject
gthread
m4macros
po
tests
collate
gobject
refcount
.gitignore
Makefile.am
assert-msg-test.c
asyncqueue-test.c
atomic-test.c
bit-test.c
casefold.txt
casemap.txt
child-test.c
completion-test.c
cxx-test.C
dirname-test.c
env-test.c
errorcheck-mutex-test.c
file-test.c
gen-casefold-txt.pl
gen-casemap-txt.pl
gio-ls.c
gio-test.c
iochannel-test-infile
iochannel-test.c
libmoduletestplugin_a.c
libmoduletestplugin_b.c
mainloop-test.c
makefile.msc.in
mapping-test.c
memchunks.c
module-test.c
onceinit.c
qsort-test.c
relation-test.c
run-assert-msg-test.sh
run-collate-tests.sh
slice-color.c
slice-concurrent.c
slice-test.c
slice-threadinit.c
spawn-test-win32-gui.c
spawn-test.c
testgdate.c
testgdateparser.c
testglib.c
thread-test.c
threadpool-test.c
timeloop-basic.c
timeloop-closure.c
timeloop.c
type-test.c
unicode-caseconv.c
unicode-collate.c
unicode-encoding.c
unicode-normalize.c
utf8.txt
.gitignore
AUTHORS
COPYING
ChangeLog.pre-1-2
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-14
ChangeLog.pre-2-16
ChangeLog.pre-2-18
ChangeLog.pre-2-2
ChangeLog.pre-2-20
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
HACKING
INSTALL.in
MAINTAINERS
Makefile.am
Makefile.decl
NEWS
NEWS.pre-1-3
README.commits
README.in
README.win32
acglib.m4
acinclude.m4
autogen.sh
config.h.win32.in
configure.ac
gio-2.0-uninstalled.pc.in
gio-2.0.pc.in
gio-unix-2.0-uninstalled.pc.in
gio-unix-2.0.pc.in
gio-windows-2.0.pc.in
glib-2.0-uninstalled.pc.in
glib-2.0.pc.in
glib-gettextize.in
glib-zip.in
gmodule-2.0-uninstalled.pc.in
gmodule-2.0.pc.in
gmodule-export-2.0.pc.in
gmodule-no-export-2.0-uninstalled.pc.in
gmodule-no-export-2.0.pc.in
gobject-2.0-uninstalled.pc.in
gobject-2.0.pc.in
gthread-2.0-uninstalled.pc.in
gthread-2.0.pc.in
makefile.msc
mkinstalldirs
msvc_recommended_pragmas.h
sanity_check
win32-fixup.pl
2002-07-04 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * tests/*.c: Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN throughout the files, which didn't already have them. (#87312)
116 lines
2.2 KiB
C
116 lines
2.2 KiB
C
#undef G_DISABLE_ASSERT
|
|
#undef G_LOG_DOMAIN
|
|
|
|
#ifdef GLIB_COMPILATION
|
|
#undef GLIB_COMPILATION
|
|
#endif
|
|
|
|
#include "glib.h"
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <locale.h>
|
|
|
|
void g_date_debug_print(GDate* d)
|
|
{
|
|
if (!d) g_print("NULL!\n");
|
|
else
|
|
g_print("julian: %u (%s) DMY: %u %u %u (%s)\n",
|
|
d->julian_days,
|
|
d->julian ? "valid" : "invalid",
|
|
d->day,
|
|
d->month,
|
|
d->year,
|
|
d->dmy ? "valid" : "invalid");
|
|
|
|
fflush(stdout);
|
|
}
|
|
|
|
/* These only work in the POSIX locale, maybe C too -
|
|
* type POSIX into the program to check them
|
|
*/
|
|
char* posix_tests [] = {
|
|
"19981024",
|
|
"981024",
|
|
"October 1998",
|
|
"October 98",
|
|
"oCT 98",
|
|
"10/24/98",
|
|
"10 -- 24 -- 98",
|
|
"10/24/1998",
|
|
"October 24, 1998",
|
|
NULL
|
|
};
|
|
|
|
int main(int argc, char** argv)
|
|
{
|
|
GDate* d;
|
|
gchar* loc;
|
|
gchar input[1024];
|
|
|
|
loc = setlocale(LC_ALL,"");
|
|
if (loc)
|
|
g_print("\nLocale set to %s\n", loc);
|
|
else
|
|
g_print("\nLocale unchanged\n");
|
|
|
|
d = g_date_new();
|
|
|
|
while (fgets(input, 1023, stdin))
|
|
{
|
|
if (input[0] == '\n')
|
|
{
|
|
g_print("Enter a date to parse and press enter, or type `POSIX':\n");
|
|
continue;
|
|
}
|
|
|
|
if (strcmp(input,"POSIX\n") == 0)
|
|
{
|
|
char** s = posix_tests;
|
|
while (*s) {
|
|
g_date_set_parse(d, *s);
|
|
|
|
g_print("POSIXy parse test `%s' ...", *s);
|
|
|
|
if (!g_date_valid(d))
|
|
{
|
|
g_print(" failed.\n");
|
|
}
|
|
else
|
|
{
|
|
gchar buf[256];
|
|
|
|
g_date_strftime(buf,100," parsed `%x' (%B %d %Y)\n",
|
|
d);
|
|
g_print("%s", buf);
|
|
}
|
|
|
|
++s;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
g_date_set_parse(d, input);
|
|
|
|
if (!g_date_valid(d))
|
|
{
|
|
g_print("Parse failed.\n");
|
|
}
|
|
else
|
|
{
|
|
gchar buf[256];
|
|
|
|
g_date_strftime(buf,100,"Parsed: `%x' (%B %d %Y)\n",
|
|
d);
|
|
g_print("%s", buf);
|
|
}
|
|
}
|
|
}
|
|
|
|
g_date_free(d);
|
|
|
|
return 0;
|
|
}
|
|
|
|
|