]> git.proxmox.com Git - libgit2.git/blame - tests/libgit2/date/rfc2822.c
Merge https://salsa.debian.org/debian/libgit2 into proxmox/bullseye
[libgit2.git] / tests / libgit2 / date / rfc2822.c
CommitLineData
51297cad
JG
1#include "clar_libgit2.h"
2
e579e0f7 3#include "date.h"
51297cad
JG
4
5void 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
16void 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
27void 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