Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
move TestPubKeyVerifyNil from lib/cgo/tests/check_cipher.crypto.c to lib/cgo/tests/check_cipher.crypto.common.c
ref skycoin#34
  • Loading branch information
Alvaro Denis committed May 16, 2019
1 parent f08c9b5 commit 50eb911
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
19 changes: 0 additions & 19 deletions lib/cgo/tests/check_cipher.crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,6 @@

// TestSuite(cipher_crypto, .init = setup, .fini = teardown);





START_TEST(TestPubKeyVerifyNil)
{
cipher__PubKey p = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0};
unsigned int errorcode;

errorcode = SKY_cipher_PubKey_Verify(&p);
ck_assert(errorcode == SKY_ErrInvalidPubKey);
}
END_TEST

START_TEST(TestPubKeyVerifyDefault1)
{
cipher__PubKey p;
Expand Down Expand Up @@ -726,7 +708,6 @@ Suite* cipher_crypto(void)

tc = tcase_create("cipher.crypto");
tcase_add_checked_fixture(tc, setup, teardown);
tcase_add_test(tc, TestPubKeyVerifyNil);
tcase_add_test(tc, TestPubKeyVerifyDefault1);
tcase_add_test(tc, TestPubKeyRipemd160);
tcase_add_test(tc, TestPubKeyToAddress2);
Expand Down
15 changes: 15 additions & 0 deletions lib/cgo/tests/check_cipher.crypto.common.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,20 @@ START_TEST(TestPubKeyVerify)
}
END_TEST

START_TEST(TestPubKeyVerifyNil)
{
cipher__PubKey p = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0};
unsigned int errorcode;

errorcode = SKY_cipher_PubKey_Verify(&p);
ck_assert(errorcode == SKY_ErrInvalidPubKey);
}
END_TEST

// define test suite and cases
Suite *common_check_cipher_crypto(void)
{
Expand All @@ -155,6 +169,7 @@ Suite *common_check_cipher_crypto(void)
tcase_add_test(tc, TestPubKeyFromHex);
tcase_add_test(tc, TestPubKeyHex);
tcase_add_test(tc, TestPubKeyVerify);
tcase_add_test(tc, TestPubKeyVerifyNil);
suite_add_tcase(s, tc);
tcase_set_timeout(tc, 150);

Expand Down

0 comments on commit 50eb911

Please sign in to comment.