Commit d9e9239a authored by Matthias Clasen's avatar Matthias Clasen

Add a test for g_date_time_new_from_timeval_utc

parent c739a5df
......@@ -325,6 +325,31 @@ test_GDateTime_new_from_timeval (void)
g_date_time_unref (dt);
}
static void
test_GDateTime_new_from_timeval_utc (void)
{
GDateTime *dt;
GTimeVal tv, tv2;
g_get_current_time (&tv);
dt = g_date_time_new_from_timeval_utc (&tv);
if (g_test_verbose ())
g_print ("\nDT%04d-%02d-%02dT%02d:%02d:%02d%s\n",
g_date_time_get_year (dt),
g_date_time_get_month (dt),
g_date_time_get_day_of_month (dt),
g_date_time_get_hour (dt),
g_date_time_get_minute (dt),
g_date_time_get_second (dt),
g_date_time_get_timezone_abbreviation (dt));
g_date_time_to_timeval (dt, &tv2);
g_assert_cmpint (tv.tv_sec, ==, tv2.tv_sec);
g_assert_cmpint (tv.tv_usec, ==, tv2.tv_usec);
g_date_time_unref (dt);
}
static void
test_GDateTime_to_unix (void)
{
......@@ -1167,6 +1192,7 @@ main (gint argc,
g_test_add_func ("/GDateTime/new_from_unix", test_GDateTime_new_from_unix);
g_test_add_func ("/GDateTime/new_from_unix_utc", test_GDateTime_new_from_unix_utc);
g_test_add_func ("/GDateTime/new_from_timeval", test_GDateTime_new_from_timeval);
g_test_add_func ("/GDateTime/new_from_timeval_utc", test_GDateTime_new_from_timeval_utc);
g_test_add_func ("/GDateTime/new_full", test_GDateTime_new_full);
g_test_add_func ("/GDateTime/now", test_GDateTime_now);
g_test_add_func ("/GDateTime/printf", test_GDateTime_printf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment