Skip to content

Commit

Permalink
[libc][test] refs skycoin#105 Finalized test TestMaxChildDepthError
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Aug 17, 2019
1 parent 33522fc commit 9b68f75
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions lib/cgo/tests/check_cipher.bip32.bip32.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,46 @@ typedef struct {
} testMasterKey;


START_TEST(TestBip32TestVectors)
START_TEST(TestMaxChildDepthError)
{
GoUint8 bufferTemp[1024];
GoSlice tmp = {bufferTemp, 0, 32};
randBytes(&tmp, 32);
PrivateKey__Handle key = 0;
GoUint32 err = SKY_bip32_NewMasterKey(tmp, &key);
ck_assert_int_eq(err, SKY_OK);
GoUint8 reached = 0;
for (size_t i = 0; i < 256; i++) {
err = SKY_bip32_Private_NewPrivateChildKey(key, 0, &key);
switch (i) {
case 255:
ck_assert_int_eq(err, SKY_ERROR);
reached = 1;
break;

default:
ck_assert_int_eq(err, SKY_OK);
break;
}
}
ck_assert(reached == 1);
}
END_TEST

START_TEST(TestImpossibleChildError){



}END_TEST
Suite* cipher_bip32(void)
{
Suite* s = suite_create("Load cipher.bip32");
TCase* tc;

tc = tcase_create("cipher.bip32");
tcase_add_checked_fixture(tc, setup, teardown);
tcase_add_test(tc, TestBip32TestVectors);
tcase_add_test(tc, TestMaxChildDepthError);
tcase_add_test(tc, TestImpossibleChildError);
suite_add_tcase(s, tc);
tcase_set_timeout(tc, 150);

Expand Down

0 comments on commit 9b68f75

Please sign in to comment.