1 #include <glib.h>
2 
3 #include "date.h"
4 
5 
6 static void
test_createRFC822Date(void)7 test_createRFC822Date (void)
8 {
9 	gchar *buf;
10 	time_t t = 0;
11 
12 	buf = createRFC822Date(&t);
13 	if (g_test_verbose())
14 		g_printerr("time_t %ld => '%s'\n", t, buf);
15 	g_assert_cmpstr(buf, ==, "Thu,  1 Jan 1970 00:00:00 GMT");
16 	g_free(buf);
17 
18 	t = 1534240471;
19 	buf = createRFC822Date(&t);
20 	if (g_test_verbose())
21 		g_printerr("time_t %ld => '%s'\n", t, buf);
22 	g_assert_cmpstr(buf, ==, "Tue, 14 Aug 2018 09:54:31 GMT");
23 	g_free(buf);
24 }
25 
26 int
main(int argc,char * argv[])27 main (int argc, char *argv[])
28 {
29 	g_test_init(&argc, &argv, NULL);
30 
31 	g_test_add_func("/rssyl/libfeed/createRFC822Date", test_createRFC822Date);
32 
33 	return g_test_run();
34 }
35