]> git.proxmox.com Git - libgit2.git/blob - tests/libgit2/date/rfc2822.c
New upstream version 1.5.0+ds
[libgit2.git] / tests / libgit2 / date / rfc2822.c
1 #include "clar_libgit2.h"
2
3 #include "date.h"
4
5 void test_date_rfc2822__format_rfc2822_no_offset(void)
6 {
7 git_time t = {1397031663, 0};
8 git_str buf = GIT_STR_INIT;
9
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);
14 }
15
16 void test_date_rfc2822__format_rfc2822_positive_offset(void)
17 {
18 git_time t = {1397031663, 120};
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);
23
24 git_str_dispose(&buf);
25 }
26
27 void test_date_rfc2822__format_rfc2822_negative_offset(void)
28 {
29 git_time t = {1397031663, -120};
30 git_str buf = GIT_STR_INIT;
31
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);
34
35 git_str_dispose(&buf);
36 }
37