diff --git a/lib/cgo/tests/check_cipher.hash.c b/lib/cgo/tests/check_cipher.hash.c index bf4fba6d3..03aeb2bf5 100644 --- a/lib/cgo/tests/check_cipher.hash.c +++ b/lib/cgo/tests/check_cipher.hash.c @@ -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; @@ -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); diff --git a/lib/cgo/tests/check_cipher.hash.common.c b/lib/cgo/tests/check_cipher.hash.common.c index f243d85aa..072f57d48 100644 --- a/lib/cgo/tests/check_cipher.hash.common.c +++ b/lib/cgo/tests/check_cipher.hash.common.c @@ -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; @@ -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);