diff options
author | Frederic Martinsons <frederic.martinsons@sigfox.com> | 2021-10-15 17:02:20 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2021-10-22 13:48:20 +0200 |
commit | 9d82d309782c70ed7247db32902f48adebe90669 (patch) | |
tree | bb6a51a909ae9c544d05986c9b9beb96013887df /libmm-glib/tests | |
parent | 0510e9aef8818eeaa445aea246b670871c671ddb (diff) |
cli, plugins: factorize usage of iso8601 datetime format
Signed-off-by: Frederic Martinsons <frederic.martinsons@sigfox.com>
Includes updates by Aleksander Morgado to fix coding style issues.
Diffstat (limited to 'libmm-glib/tests')
-rw-r--r-- | libmm-glib/tests/test-common-helpers.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libmm-glib/tests/test-common-helpers.c b/libmm-glib/tests/test-common-helpers.c index 19e1122a..69b95cb1 100644 --- a/libmm-glib/tests/test-common-helpers.c +++ b/libmm-glib/tests/test-common-helpers.c @@ -598,6 +598,24 @@ hexstr_wrong_digits_some (void) common_hexstr2bin_test_failure ("012345k7"); } +static void +date_time_iso8601 (void) +{ + gchar *date = NULL; + + date = mm_new_iso8601_time_from_unix_time (1634307342); + g_assert_cmpstr (date, ==, "2021-10-15T14:15:42Z"); + g_free (date); + + date = mm_new_iso8601_time (2021, 10, 15, 16, 15, 42, FALSE, 0); + g_assert_cmpstr (date, ==, "2021-10-15T16:15:42Z"); + g_free (date); + + date = mm_new_iso8601_time (2021, 10, 15, 16, 15, 42, TRUE, 120); + g_assert_cmpstr (date, ==, "2021-10-15T16:15:42+02"); + g_free (date); +} + /**************************************************************/ int main (int argc, char **argv) @@ -644,5 +662,6 @@ int main (int argc, char **argv) g_test_add_func ("/MM/Common/HexStr/wrong-digits-all", hexstr_wrong_digits_all); g_test_add_func ("/MM/Common/HexStr/wrong-digits-some", hexstr_wrong_digits_some); + g_test_add_func ("/MM/Common/DateTime/iso8601", date_time_iso8601); return g_test_run (); } |