Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
move TestSHA256Null from lib/cgo/tests/check_cipher.hash.c to lib/cgo/tests/check_cipher.hash.common.c
ref #34
  • Loading branch information
stdevAlDen committed May 15, 2019
1 parent 0408866 commit 9038eeb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
17 changes: 0 additions & 17 deletions lib/cgo/tests/check_cipher.hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,6 @@ START_TEST(TestMerkle)
}
END_TEST

START_TEST(TestSHA256Null)
{
cipher__SHA256 x;
memset(&x, 0, sizeof(cipher__SHA256));
GoUint32 result;
GoUint8 isNull;
ck_assert(SKY_cipher_SHA256_Null(&x, &isNull) == SKY_OK);
ck_assert(isNull);
char buff[130];
GoSlice b = {buff, 0, 129};
randBytes(&b, 128);
ck_assert(SKY_cipher_SumSHA256(b, &x) == SKY_OK);
ck_assert(SKY_cipher_SHA256_Null(&x, &isNull) == SKY_OK);
ck_assert(isNull == 0);
}
END_TEST

Suite* cipher_hash(void)
{
Suite* s = suite_create("Load cipher.hash");
Expand Down
17 changes: 17 additions & 0 deletions lib/cgo/tests/check_cipher.hash.common.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,23 @@ START_TEST(TestSHA256FromHex)
}
END_TEST

START_TEST(TestSHA256Null)
{
cipher__SHA256 x;
memset(&x, 0, sizeof(cipher__SHA256));
GoUint32 result;
GoUint8 isNull;
ck_assert(SKY_cipher_SHA256_Null(&x, &isNull) == SKY_OK);
ck_assert(isNull);
char buff[130];
GoSlice b = {buff, 0, 129};
randBytes(&b, 128);
ck_assert(SKY_cipher_SumSHA256(b, &x) == SKY_OK);
ck_assert(SKY_cipher_SHA256_Null(&x, &isNull) == SKY_OK);
ck_assert(isNull == 0);
}
END_TEST

// define test suite and cases
Suite *common_check_cipher_hash(void)
{
Expand Down

0 comments on commit 9038eeb

Please sign in to comment.