]>
git.proxmox.com Git - libgit2.git/blob - tests/date/rfc2822.c
eda475ac98098c41c1b3e5f0d659b17134ce86e8
1 #include "clar_libgit2.h"
5 void test_date_rfc2822__format_rfc2822_no_offset(void)
7 git_time t
= {1397031663, 0};
8 char buf
[GIT_DATE_RFC2822_SZ
];
10 cl_git_pass(git__date_rfc2822_fmt(buf
, sizeof(buf
), &t
));
11 cl_assert(strcmp(buf
, "Wed, 9 Apr 2014 08:21:03 +0000") == 0);
14 void test_date_rfc2822__format_rfc2822_positive_offset(void)
16 git_time t
= {1397031663, 120};
17 char buf
[GIT_DATE_RFC2822_SZ
];
19 cl_git_pass(git__date_rfc2822_fmt(buf
, sizeof(buf
), &t
));
20 cl_assert(strcmp(buf
, "Wed, 9 Apr 2014 10:21:03 +0200") == 0);
23 void test_date_rfc2822__format_rfc2822_negative_offset(void)
25 git_time t
= {1397031663, -120};
26 char buf
[GIT_DATE_RFC2822_SZ
];
28 cl_git_pass(git__date_rfc2822_fmt(buf
, sizeof(buf
), &t
));
29 cl_assert(strcmp(buf
, "Wed, 9 Apr 2014 06:21:03 -0200") == 0);
32 void test_date_rfc2822__format_rfc2822_buffer_too_small(void)
34 // "Wed, 10 Apr 2014 08:21:03 +0000"
35 git_time t
= {1397031663 + 86400, 0};
36 char buf
[GIT_DATE_RFC2822_SZ
-1];
38 cl_git_fail(git__date_rfc2822_fmt(buf
, sizeof(buf
), &t
));