Skip to content

Commit

Permalink
remove TestPubKeyToAddress2 from the hw suit ref #34
Browse files Browse the repository at this point in the history
  • Loading branch information
Alvaro Denis committed Aug 26, 2019
1 parent 524c394 commit b2f7e3c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
31 changes: 30 additions & 1 deletion lib/cgo/tests/check_cipher.crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,34 @@ START_TEST(TestECDHloop)
}
END_TEST

START_TEST(TestPubKeyToAddress2)
{
cipher__PubKey p;
cipher__SecKey s;
cipher__Address addr;
GoString_ addrStr;
int i;
GoUint32 errorcode;

for (i = 0; i < 1024; i++) {
SKY_cipher_GenerateKeyPair(&p, &s);
SKY_cipher_AddressFromPubKey(&p, &addr);
//func (self Address) Verify(key PubKey) error
errorcode = SKY_cipher_Address_Verify(&addr, &p);
ck_assert(errorcode == SKY_OK);
SKY_cipher_Address_String(&addr, &addrStr);
unsigned char buff[50];
GoString addrStr_tmp = {buff, 0};
addrStr_tmp.p = addrStr.p;
addrStr_tmp.n = addrStr.n;
registerMemCleanup((void*)addrStr.p);
errorcode = SKY_cipher_DecodeBase58Address(addrStr_tmp, &addr);
//func DecodeBase58Address(addr string) (Address, error)
ck_assert(errorcode == SKY_OK);
}
}
END_TEST

Suite* cipher_crypto(void)
{
Suite* s = suite_create("Load cipher.crypto");
Expand All @@ -418,8 +446,9 @@ Suite* cipher_crypto(void)
tcase_add_test(tc, TestGenerateKeyPair);
tcase_add_test(tc, TestECDHonce);
tcase_add_test(tc, TestECDHloop);
tcase_add_test(tc, TestPubKeyToAddress2);
suite_add_tcase(s, tc);
tcase_set_timeout(tc, 150);

return s;
}
}
29 changes: 0 additions & 29 deletions lib/cgo/tests/check_cipher.crypto.common.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,34 +169,6 @@ START_TEST(TestPubKeyVerifyDefault1)
}
END_TEST

START_TEST(TestPubKeyToAddress2)
{
cipher__PubKey p;
cipher__SecKey s;
cipher__Address addr;
GoString_ addrStr;
int i;
GoUint32 errorcode;

for (i = 0; i < 1024; i++) {
SKY_cipher_GenerateKeyPair(&p, &s);
SKY_cipher_AddressFromPubKey(&p, &addr);
//func (self Address) Verify(key PubKey) error
errorcode = SKY_cipher_Address_Verify(&addr, &p);
ck_assert(errorcode == SKY_OK);
SKY_cipher_Address_String(&addr, &addrStr);
unsigned char buff[50];
GoString addrStr_tmp = {buff, 0};
addrStr_tmp.p = addrStr.p;
addrStr_tmp.n = addrStr.n;
registerMemCleanup((void*)addrStr.p);
errorcode = SKY_cipher_DecodeBase58Address(addrStr_tmp, &addr);
//func DecodeBase58Address(addr string) (Address, error)
ck_assert(errorcode == SKY_OK);
}
}
END_TEST

START_TEST(TestNewSig)
{
unsigned char buff[101];
Expand Down Expand Up @@ -352,7 +324,6 @@ Suite *common_check_cipher_crypto(void)
tcase_add_test(tc, TestPubKeyVerify);
tcase_add_test(tc, TestPubKeyVerifyNil);
tcase_add_test(tc, TestPubKeyVerifyDefault1);
tcase_add_test(tc, TestPubKeyToAddress2);
tcase_add_test(tc, TestNewSig);
tcase_add_test(tc, TestMustSigFromHex);
tcase_add_test(tc, TestSigHex);
Expand Down

0 comments on commit b2f7e3c

Please sign in to comment.