Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
51297cad
Commit
51297cad
authored
Apr 10, 2014
by
Jacques Germishuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added RFC2822 date format test cases
parent
8e14b47f
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
tests/date/rfc2822.c
+40
-0
No files found.
tests/date/rfc2822.c
0 → 100644
View file @
51297cad
#include "clar_libgit2.h"
#include "util.h"
void
test_date_rfc2822__format_rfc2822_no_offset
(
void
)
{
git_time
t
=
{
1397031663
,
0
};
char
buf
[
GIT_DATE_RFC2822_SZ
];
cl_git_pass
(
git__date_rfc2822_fmt
(
buf
,
sizeof
(
buf
),
&
t
));
cl_assert
(
strcmp
(
buf
,
"Wed, 9 Apr 2014 08:21:03 +0000"
)
==
0
);
}
void
test_date_rfc2822__format_rfc2822_positive_offset
(
void
)
{
git_time
t
=
{
1397031663
,
120
};
char
buf
[
GIT_DATE_RFC2822_SZ
];
cl_git_pass
(
git__date_rfc2822_fmt
(
buf
,
sizeof
(
buf
),
&
t
));
cl_assert
(
strcmp
(
buf
,
"Wed, 9 Apr 2014 10:21:03 +0200"
)
==
0
);
}
void
test_date_rfc2822__format_rfc2822_negative_offset
(
void
)
{
git_time
t
=
{
1397031663
,
-
120
};
char
buf
[
GIT_DATE_RFC2822_SZ
];
cl_git_pass
(
git__date_rfc2822_fmt
(
buf
,
sizeof
(
buf
),
&
t
));
cl_assert
(
strcmp
(
buf
,
"Wed, 9 Apr 2014 06:21:03 -0200"
)
==
0
);
}
void
test_date_rfc2822__format_rfc2822_buffer_too_small
(
void
)
{
// "Wed, 10 Apr 2014 08:21:03 +0000"
git_time
t
=
{
1397031663
+
86400
,
0
};
char
buf
[
GIT_DATE_RFC2822_SZ
-
1
];
cl_git_fail
(
git__date_rfc2822_fmt
(
buf
,
sizeof
(
buf
),
&
t
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment