Skip to content

Commit

Permalink
move TestSumSHA256 out of hw tests ref #108
Browse files Browse the repository at this point in the history
  • Loading branch information
stdevAlDen committed Sep 10, 2019
1 parent 2f3328d commit 94769a3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 23 deletions.
25 changes: 25 additions & 0 deletions lib/cgo/tests/check_cipher.hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,30 @@

extern void freshSumSHA256(GoSlice bytes, cipher__SHA256* sha256);



START_TEST(TestSumSHA256)
{
GoUint8 bbuff[257];
GoUint8 cbuff[257];
GoSlice b = {bbuff, 0, 257};
cipher__SHA256 h1;
// randBytes(&b, 256);
SKY_cipher_RandByte(256, &b);
SKY_cipher_SumSHA256(b, &h1);
cipher__SHA256 tmp = "";
ck_assert_int_eq(isU8Eq(h1, tmp, 32), 0);
GoSlice c = {cbuff, 0, 257};
randBytes(&c, 256);
cipher__SHA256 h2;
SKY_cipher_SumSHA256(c, &h2);
ck_assert_int_eq(isU8Eq(h1, tmp, 32), 0);
cipher__SHA256 tmp_h2;
freshSumSHA256(c, &tmp_h2);
ck_assert(isU8Eq(h2, tmp_h2, 32));
}
END_TEST

START_TEST(TestRipemd160Set)
{
cipher__Ripemd160 h;
Expand Down Expand Up @@ -144,6 +168,7 @@ Suite* cipher_hash(void)

tc = tcase_create("cipher.hash");
tcase_add_checked_fixture(tc, setup, teardown);
tcase_add_test(tc, TestSumSHA256);
tcase_add_test(tc, TestRipemd160Set);
tcase_add_test(tc, TestDoubleSHA256);
tcase_add_test(tc, TestXorSHA256);
Expand Down
23 changes: 0 additions & 23 deletions lib/cgo/tests/check_cipher.hash.common.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,28 +111,6 @@ START_TEST(TestSHA256KnownValue)
}
END_TEST

START_TEST(TestSumSHA256)
{
GoUint8 bbuff[257];
GoUint8 cbuff[257];
GoSlice b = {bbuff, 0, 257};
cipher__SHA256 h1;
// randBytes(&b, 256);
SKY_cipher_RandByte(256, &b);
SKY_cipher_SumSHA256(b, &h1);
cipher__SHA256 tmp = "";
ck_assert_int_eq(isU8Eq(h1, tmp, 32), 0);
GoSlice c = {cbuff, 0, 257};
randBytes(&c, 256);
cipher__SHA256 h2;
SKY_cipher_SumSHA256(c, &h2);
ck_assert_int_eq(isU8Eq(h1, tmp, 32), 0);
cipher__SHA256 tmp_h2;
freshSumSHA256(c, &tmp_h2);
ck_assert(isU8Eq(h2, tmp_h2, 32));
}
END_TEST

START_TEST(TestSHA256Hex)
{
cipher__SHA256 h;
Expand Down Expand Up @@ -250,7 +228,6 @@ Suite* common_check_cipher_hash(void)
tcase_add_test(tc, TestAddSHA256);
tcase_add_test(tc, TestHashRipemd160);
tcase_add_test(tc, TestSHA256KnownValue);
tcase_add_test(tc, TestSumSHA256);
tcase_add_test(tc, TestSHA256Hex);
tcase_add_test(tc, TestSHA256FromHex);
tcase_add_test(tc, TestSHA256Null);
Expand Down

0 comments on commit 94769a3

Please sign in to comment.