Skip to content

Commit

Permalink
tests: skip sha256 tests when not compiled in
Browse files Browse the repository at this point in the history
Actually `cl_skip` the sha256 tests when we're not compiled for sha256,
instead of passing them.
  • Loading branch information
ethomson committed Sep 19, 2022
1 parent d111cc9 commit c8d5b43
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
12 changes: 9 additions & 3 deletions tests/libgit2/core/oid.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ void test_core_oid__streq_sha1(void)

void test_core_oid__streq_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
cl_assert_equal_i(0, git_oid_streq(&id_sha256, str_oid_sha256));
cl_assert_equal_i(-1, git_oid_streq(&id_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"));

Expand Down Expand Up @@ -90,7 +92,9 @@ void test_core_oid__strcmp_sha1(void)

void test_core_oid__strcmp_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
cl_assert_equal_i(0, git_oid_strcmp(&id_sha256, str_oid_sha256));
cl_assert(git_oid_strcmp(&id_sha256, "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef") < 0);

Expand Down Expand Up @@ -129,7 +133,9 @@ void test_core_oid__ncmp_sha1(void)

void test_core_oid__ncmp_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 0));
cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 1));
cl_assert(!git_oid_ncmp(&id_sha256, &idp_sha256, 2));
Expand Down
16 changes: 12 additions & 4 deletions tests/libgit2/odb/loose.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ void test_odb_loose__exists_sha1(void)

void test_odb_loose__exists_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
git_oid id, id2;
git_odb *odb;
git_odb_options odb_opts = GIT_ODB_OPTIONS_INIT;
Expand Down Expand Up @@ -201,7 +203,9 @@ void test_odb_loose__simple_reads_sha1(void)

void test_odb_loose__simple_reads_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
test_read_object(&commit_sha256);
test_read_object(&tree_sha256);
test_read_object(&tag_sha256);
Expand Down Expand Up @@ -230,7 +234,9 @@ void test_odb_loose__streaming_reads_sha1(void)

void test_odb_loose__streaming_reads_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
size_t blocksizes[] = { 1, 2, 4, 16, 99, 1024, 123456789 };
size_t i;

Expand Down Expand Up @@ -259,7 +265,9 @@ void test_odb_loose__read_header_sha1(void)

void test_odb_loose__read_header_sha256(void)
{
#ifdef GIT_EXPERIMENTAL_SHA256
#ifndef GIT_EXPERIMENTAL_SHA256
cl_skip();
#else
test_read_header(&commit_sha256);
test_read_header(&tree_sha256);
test_read_header(&tag_sha256);
Expand Down

0 comments on commit c8d5b43

Please sign in to comment.