From 947f42a7c84718e5a0434f69f1faff4adc01227f Mon Sep 17 00:00:00 2001 From: MITSUNARI Shigeo Date: Sun, 23 Apr 2017 21:49:53 +0900 Subject: move benchmark to last --- go/bls/bls_test.go | 61 +++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 28 deletions(-) (limited to 'go/bls/bls_test.go') 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) - } -} -- cgit v1.2.3