diff options
author | MITSUNARI Shigeo <herumi@nifty.com> | 2017-04-23 20:49:53 +0800 |
---|---|---|
committer | MITSUNARI Shigeo <herumi@nifty.com> | 2017-04-23 20:49:53 +0800 |
commit | 947f42a7c84718e5a0434f69f1faff4adc01227f (patch) | |
tree | a2044f119cda9622d46cba7cd4111fbe031c7bfe /go | |
parent | 728b084e9acfd968e03ef299b97a4f844a730cbd (diff) | |
download | dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar.gz dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar.bz2 dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar.lz dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar.xz dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.tar.zst dexon-bls-947f42a7c84718e5a0434f69f1faff4adc01227f.zip |
move benchmark to last
Diffstat (limited to 'go')
-rw-r--r-- | go/bls/bls_test.go | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/go/bls/bls_test.go b/go/bls/bls_test.go index b36376d..50f1b7e 100644 --- a/go/bls/bls_test.go +++ b/go/bls/bls_test.go @@ -3,11 +3,10 @@ package bls import "testing" import "strconv" -var curve = CurveFp382_1 - -//var curve = CurveFp254BNb var unitN = 0 +// Tests (for Benchmarks see below) + func testPre(t *testing.T) { t.Log("init") { @@ -229,6 +228,37 @@ func testData(t *testing.T) { } } + +func test(t *testing.T, c int) { + Init(c) + unitN = GetOpUnitSize() + t.Logf("unitN=%d\n", unitN) + testPre(t) + testRecoverSecretKey(t) + testAdd(t) + testSign(t) + testPop(t) + testData(t) + testStringConversion(t) +} + +func TestMain(t *testing.T) { + t.Logf("GetMaxOpUnitSize() = %d\n", GetMaxOpUnitSize()) + t.Log("CurveFp254BNb") + test(t, CurveFp254BNb) + if GetMaxOpUnitSize() == 6 { + t.Log("CurveFp382_1") + test(t, CurveFp382_1) + t.Log("CurveFp382_2") + test(t, CurveFp382_2) + } +} + +// Benchmarks + +var curve = CurveFp382_1 +//var curve = CurveFp254BNb + func BenchmarkPubkeyFromSeckey(b *testing.B) { b.StopTimer() Init(curve) @@ -348,28 +378,3 @@ func BenchmarkRecoverSignature100(b *testing.B) { benchmarkRecoverSignature(100 func BenchmarkRecoverSignature200(b *testing.B) { benchmarkRecoverSignature(200, b) } func BenchmarkRecoverSignature500(b *testing.B) { benchmarkRecoverSignature(500, b) } func BenchmarkRecoverSignature1000(b *testing.B) { benchmarkRecoverSignature(1000, b) } - -func test(t *testing.T, c int) { - Init(c) - unitN = GetOpUnitSize() - t.Logf("unitN=%d\n", unitN) - testPre(t) - testRecoverSecretKey(t) - testAdd(t) - testSign(t) - testPop(t) - testData(t) - testStringConversion(t) -} - -func TestMain(t *testing.T) { - t.Logf("GetMaxOpUnitSize() = %d\n", GetMaxOpUnitSize()) - t.Log("CurveFp254BNb") - test(t, CurveFp254BNb) - if GetMaxOpUnitSize() == 6 { - t.Log("CurveFp382_1") - test(t, CurveFp382_1) - t.Log("CurveFp382_2") - test(t, CurveFp382_2) - } -} |