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