Skip to content

Commit

Permalink
[test-libsky] refs #72 Finalized test TestMaxChildDepthError
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Oct 28, 2019
1 parent 2f44947 commit 9793034
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/swig/LibskycoinNetTest/check_cipher_bip32.cs
Original file line number Diff line number Diff line change
Expand Up @@ -661,5 +661,33 @@ public void TestParentPublicChildDerivation()
Assert.AreEqual(isPublicKeyEq(pubKey, pubKey3), 1);
}
}

[Test]
public void TestMaxChildDepthError()
{
var tmp = new GoSlice();
var err = SKY_cipher_RandByte(32, tmp);
Assert.AreEqual(err, SKY_OK);
var key = new_PrivateKey__HandlePtr();
err = SKY_bip32_NewMasterKey(tmp, key);
Assert.AreEqual(err, SKY_OK);
byte reached = 0;
for (var i = 0; i < 256; i++)
{
err = SKY_bip32_PrivateKey_NewPrivateChildKey(key, 0, key);
switch (i)
{
case 255:
Assert.AreEqual(err, SKY_ErrMaxDepthReached);
reached = 1;
break;

default:
Assert.AreEqual(err, SKY_OK);
break;
}
}
Assert.AreEqual(reached, 1);
}
}
}

0 comments on commit 9793034

Please sign in to comment.