diff --git a/lib/cgo/tests/check_cipher.crypto.c b/lib/cgo/tests/check_cipher.crypto.c index 3cebf57b5..bf930e03c 100644 --- a/lib/cgo/tests/check_cipher.crypto.c +++ b/lib/cgo/tests/check_cipher.crypto.c @@ -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"); @@ -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; -} \ No newline at end of file +} diff --git a/lib/cgo/tests/check_cipher.crypto.common.c b/lib/cgo/tests/check_cipher.crypto.common.c index 792dc81c6..9f44048a9 100644 --- a/lib/cgo/tests/check_cipher.crypto.common.c +++ b/lib/cgo/tests/check_cipher.crypto.common.c @@ -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]; @@ -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);