diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2018-09-25 05:57:14 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2018-09-25 05:57:14 +0800 |
commit | a88d43df8e71dcab1a3a8af4e087c628f0adf922 (patch) | |
tree | e883f9e3a42622feb44505b1acebc4c2f26d9b99 | |
parent | 16d5fab948a7af47561b6bc4c9588995e737d094 (diff) | |
download | dexon-mcl-a88d43df8e71dcab1a3a8af4e087c628f0adf922.tar.gz dexon-mcl-a88d43df8e71dcab1a3a8af4e087c628f0adf922.tar.zst dexon-mcl-a88d43df8e71dcab1a3a8af4e087c628f0adf922.zip |
test IoSerializeHexStr for Go
-rw-r--r-- | ffi/go/mcl/mcl.go | 3 | ||||
-rw-r--r-- | ffi/go/mcl/mcl_test.go | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/ffi/go/mcl/mcl.go b/ffi/go/mcl/mcl.go index 8a1312c..c4240ca 100644 --- a/ffi/go/mcl/mcl.go +++ b/ffi/go/mcl/mcl.go @@ -25,6 +25,9 @@ const CurveFp382_2 = C.mclBn_CurveFp382_2 // BLS12_381 const BLS12_381 = C.MCL_BLS12_381 +// IoSerializeHexStr +const IoSerializeHexStr = C.MCLBN_IO_SERIALIZE_HEX_STR + // Init -- // call this function before calling all the other operations // this function is not thread safe diff --git a/ffi/go/mcl/mcl_test.go b/ffi/go/mcl/mcl_test.go index 7c7cb8f..ce29a50 100644 --- a/ffi/go/mcl/mcl_test.go +++ b/ffi/go/mcl/mcl_test.go @@ -112,6 +112,22 @@ func testPairing(t *testing.T) { if !e1.IsEqual(&e2) { t.Errorf("not equal pairing\n%s\n%s", e1.GetString(16), e2.GetString(16)) } + { + s := P.GetString(IoSerializeHexStr) + var P1 G1 + P1.SetString(s, IoSerializeHexStr) + if !P1.IsEqual(&P) { + t.Error("not equal to P") + return + } + s = Q.GetString(IoSerializeHexStr) + var Q1 G2 + Q1.SetString(s, IoSerializeHexStr) + if !Q1.IsEqual(&Q) { + t.Error("not equal to Q") + return + } + } } func testMcl(t *testing.T, c int) { |