-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ac413c
commit 61e8fb3
Showing
2 changed files
with
30 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
def BlsTest do | ||
use ExUnit.Case | ||
use Rustler, otp_app: :lambda_ethereum_consensus, crate: "bls_nif" | ||
alias Bls.key_validate, as: key_validate | ||
describe "validate_key" do | ||
test "returns true for valid public key" do | ||
valid_public_key = << | ||
0x8a, 0xfc, 0x8f, 0x13, 0x47, 0x90, 0x91, 0x4b, | ||
0x4a, 0x15, 0xd2, 0xfa, 0x73, 0xb0, 0x7c, 0xaf, | ||
0xd0, 0xd3, 0x08, 0x84, 0xfd, 0x80, 0xca, 0x22, | ||
0x0c, 0x8b, 0x95, 0x03, 0xf5, 0xf6, 0x9c, 0x33, | ||
0xdd, 0x27, 0x27, 0x5b, 0x12, 0x95, 0x43, 0xd2, | ||
0xf7, 0xf8, 0xf6, 0x35, 0xa8, 0x18, 0x67, 0xa0 | ||
>> | ||
assert key_validate(valid_public_key) == true | ||
end | ||
test "returns false for invalid public key" do | ||
invalid_public_key = << | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | ||
>> | ||
assert key_validate(valid_public_key) == false | ||
end | ||
end | ||
|
||
end |