Hash :
9994cd3f
Author :
Date :
2018-06-25T11:56:52
treewide: remove use of C++ style comments C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
#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));
}