Hash :
add30a83
Author :
Date :
2021-11-18T12:36:25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
#include "clar_libgit2.h"
#include "date.h"
void test_date_rfc2822__format_rfc2822_no_offset(void)
{
git_time t = {1397031663, 0};
git_str buf = GIT_STR_INIT;
cl_git_pass(git_date_rfc2822_fmt(&buf, t.time, t.offset));
cl_assert_equal_s("Wed, 9 Apr 2014 08:21:03 +0000", buf.ptr);
git_str_dispose(&buf);
}
void test_date_rfc2822__format_rfc2822_positive_offset(void)
{
git_time t = {1397031663, 120};
git_str buf = GIT_STR_INIT;
cl_git_pass(git_date_rfc2822_fmt(&buf, t.time, t.offset));
cl_assert_equal_s("Wed, 9 Apr 2014 10:21:03 +0200", buf.ptr);
git_str_dispose(&buf);
}
void test_date_rfc2822__format_rfc2822_negative_offset(void)
{
git_time t = {1397031663, -120};
git_str buf = GIT_STR_INIT;
cl_git_pass(git_date_rfc2822_fmt(&buf, t.time, t.offset));
cl_assert_equal_s("Wed, 9 Apr 2014 06:21:03 -0200", buf.ptr);
git_str_dispose(&buf);
}