mirror of https://github.com/djcb/mu.git
* test-mu-date: added some unit tests
This commit is contained in:
parent
37aaa18d6b
commit
8bc7001cc7
|
@ -129,6 +129,36 @@ test_mu_date_complete_end (void)
|
|||
|
||||
|
||||
|
||||
static void
|
||||
test_mu_date_interpret_begin (void)
|
||||
{
|
||||
time_t now;
|
||||
now = time (NULL);
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("now", TRUE) , ==,
|
||||
mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("today", TRUE) , ==,
|
||||
mu_date_str_s("%Y%m%d000000", now));
|
||||
}
|
||||
|
||||
static void
|
||||
test_mu_date_interpret_end (void)
|
||||
{
|
||||
time_t now;
|
||||
now = time (NULL);
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("now", FALSE) , ==,
|
||||
mu_date_str_s("%Y%m%d%H%M%S", now));
|
||||
|
||||
g_assert_cmpstr (mu_date_interpret_s ("today", FALSE) , ==,
|
||||
mu_date_str_s("%Y%m%d235959", now));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
|
@ -144,6 +174,12 @@ main (int argc, char *argv[])
|
|||
test_mu_date_complete_begin);
|
||||
g_test_add_func ("/mu-str/mu_date_complete_end",
|
||||
test_mu_date_complete_end);
|
||||
|
||||
g_test_add_func ("/mu-str/mu_date_interpret_begin",
|
||||
test_mu_date_interpret_begin);
|
||||
g_test_add_func ("/mu-str/mu_date_interpret_end",
|
||||
test_mu_date_interpret_end);
|
||||
|
||||
|
||||
g_log_set_handler (NULL,
|
||||
G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION,
|
||||
|
|
Loading…
Reference in New Issue