disable bench in debug mode

update-fork
MITSUNARI Shigeo 4 years ago
parent d2b2ad8144
commit b19156bf5f
  1. 12
      test/bench.hpp
  2. 12
      test/bls12_test.cpp
  3. 4
      test/fp_tower_test.cpp
  4. 4
      test/paillier_test.cpp
  5. 5
      test/she_test.cpp

@ -3,6 +3,10 @@
void benchAddDblG1() void benchAddDblG1()
{ {
puts("benchAddDblG1"); puts("benchAddDblG1");
#ifndef NDEBUG
puts("skip in debug");
return;
#endif
const int C = 100000; const int C = 100000;
G1 P1, P2, P3; G1 P1, P2, P3;
hashAndMapToG1(P1, "a"); hashAndMapToG1(P1, "a");
@ -29,6 +33,10 @@ void benchAddDblG1()
void benchAddDblG2() void benchAddDblG2()
{ {
puts("benchAddDblG2"); puts("benchAddDblG2");
#ifndef NDEBUG
puts("skip in debug");
return;
#endif
const int C = 100000; const int C = 100000;
G2 P1, P2, P3; G2 P1, P2, P3;
hashAndMapToG2(P1, "a"); hashAndMapToG2(P1, "a");
@ -61,6 +69,10 @@ void invAdd(T& out, const T& x, const T& y)
void testBench(const G1& P, const G2& Q) void testBench(const G1& P, const G2& Q)
{ {
#ifndef NDEBUG
puts("testBench skip in debug");
return;
#endif
G1 Pa; G1 Pa;
G2 Qa; G2 Qa;
Fp12 e1, e2; Fp12 e1, e2;

@ -431,6 +431,10 @@ const char *e1Str =
finalExp(e2, e0); finalExp(e2, e0);
// finalExpC(e2, e0); // finalExpC(e2, e0);
CYBOZU_TEST_EQUAL(e1, e2); CYBOZU_TEST_EQUAL(e1, e2);
#ifndef NDEBUG
puts("skip bench of finalExp in debug");
return;
#endif
CYBOZU_BENCH_C("finalExp", 100, finalExp, e2, e0); CYBOZU_BENCH_C("finalExp", 100, finalExp, e2, e0);
} }
@ -685,6 +689,10 @@ void testCurve(const mcl::CurveParam& cp)
} }
CYBOZU_TEST_AUTO(multi) CYBOZU_TEST_AUTO(multi)
{ {
#ifndef NDEBUG
puts("skip multi in debug");
return;
#endif
G1 P; G1 P;
G2 Q; G2 Q;
int i; int i;
@ -722,6 +730,10 @@ CYBOZU_TEST_AUTO(deserialize)
size_t n2 = Q.serialize(buf2, sizeof(buf2)); size_t n2 = Q.serialize(buf2, sizeof(buf2));
CYBOZU_TEST_ASSERT(n2 > 0); CYBOZU_TEST_ASSERT(n2 > 0);
CYBOZU_TEST_EQUAL(Q.deserialize(buf2, n2), n2); CYBOZU_TEST_EQUAL(Q.deserialize(buf2, n2), n2);
#ifndef NDEBUG
puts("skip bench in debug");
return;
#endif
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
bool doVerify = i == 0; bool doVerify = i == 0;
printf("verifyOrder(%d)\n", doVerify); printf("verifyOrder(%d)\n", doVerify);

@ -378,6 +378,10 @@ void testIo()
void benchFp2() void benchFp2()
{ {
puts(__FUNCTION__); puts(__FUNCTION__);
#ifndef NDEBUG
puts("skip bench in debug");
return;
#endif
Fp2 x, y; Fp2 x, y;
x.a.setStr("4"); x.a.setStr("4");
x.b.setStr("464652165165"); x.b.setStr("464652165165");

@ -5,7 +5,11 @@ CYBOZU_TEST_AUTO(paillier)
{ {
using namespace mcl::paillier; using namespace mcl::paillier;
SecretKey sec; SecretKey sec;
#ifndef NDEBUG
sec.init(512);
#else
sec.init(2048); sec.init(2048);
#endif
PublicKey pub; PublicKey pub;
sec.getPublicKey(pub); sec.getPublicKey(pub);
mpz_class m1("12342340928409"), m2("23049820498204"); mpz_class m1("12342340928409"), m2("23049820498204");

@ -43,6 +43,9 @@ double clk2msec(const cybozu::CpuClock& clk, int n)
CYBOZU_TEST_AUTO(bench2) CYBOZU_TEST_AUTO(bench2)
{ {
#ifndef NDEBUG
puts("skip bench2 in debug");
#endif
puts("msec"); puts("msec");
setTryNum(1 << 16); setTryNum(1 << 16);
useDecG1ViaGT(true); useDecG1ViaGT(true);
@ -571,7 +574,7 @@ CYBOZU_TEST_AUTO(io)
} }
} }
#ifndef PAPER #if !defined(PAPER) && defined(NDEBUG)
CYBOZU_TEST_AUTO(bench) CYBOZU_TEST_AUTO(bench)
{ {
const SecretKey& sec = g_sec; const SecretKey& sec = g_sec;

Loading…
Cancel
Save