add option for bn384_test

dev
MITSUNARI Shigeo 8 years ago
parent 7be1cd64a4
commit a0402e567b
  1. 23
      test/bn384_test.cpp

@ -1,13 +1,17 @@
#define CYBOZU_TEST_DISABLE_AUTO_RUN
#include <cybozu/test.hpp> #include <cybozu/test.hpp>
#include <cybozu/benchmark.hpp> #include <cybozu/benchmark.hpp>
#include <cybozu/option.hpp>
#include <mcl/bn384.hpp> #include <mcl/bn384.hpp>
#include <mcl/bn.hpp> #include <mcl/bn.hpp>
using namespace mcl::bn384; using namespace mcl::bn384;
mcl::fp::Mode g_mode;
void testCurve(const mcl::bn::CurveParam& cp) void testCurve(const mcl::bn::CurveParam& cp)
{ {
bn384init(cp); bn384init(cp, g_mode);
G1 P; G1 P;
G2 Q; G2 Q;
BN::mapToG1(P, 1); BN::mapToG1(P, 1);
@ -35,3 +39,20 @@ CYBOZU_TEST_AUTO(pairing)
// support 256-bit pairing // support 256-bit pairing
testCurve(mcl::bn::CurveFp254BNb); testCurve(mcl::bn::CurveFp254BNb);
} }
int main(int argc, char *argv[])
try
{
cybozu::Option opt;
std::string mode;
opt.appendOpt(&mode, "auto", "m", ": mode(gmp/gmp_mont/llvm/llvm_mont/xbyak)");
if (!opt.parse(argc, argv)) {
opt.usage();
return 1;
}
g_mode = mcl::fp::StrToMode(mode);
return cybozu::test::autoRun.run(argc, argv);
} catch (std::exception& e) {
printf("ERR %s\n", e.what());
return 1;
}

Loading…
Cancel
Save