|
|
|
@ -91,52 +91,6 @@ void blsOrderTest(const char *curveOrder/*Fr*/, const char *fieldOrder/*Fp*/) |
|
|
|
|
CYBOZU_TEST_EQUAL(buf, fieldOrder); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#if !defined(DISABLE_THREAD_TEST) || defined(__clang__) |
|
|
|
|
#if defined(CYBOZU_CPP_VERSION) && CYBOZU_CPP_VERSION >= CYBOZU_CPP_VERSION_CPP11 |
|
|
|
|
#include <thread> |
|
|
|
|
#include <vector> |
|
|
|
|
struct Thread { |
|
|
|
|
std::unique_ptr<std::thread> t; |
|
|
|
|
Thread() : t() {} |
|
|
|
|
~Thread() |
|
|
|
|
{ |
|
|
|
|
if (t) { |
|
|
|
|
t->join(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
template<class F> |
|
|
|
|
void run(F func, int p1, int p2) |
|
|
|
|
{ |
|
|
|
|
t.reset(new std::thread(func, p1, p2)); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
CYBOZU_TEST_AUTO(multipleInit) |
|
|
|
|
{ |
|
|
|
|
#if MCLBN_FP_UNIT_SIZE == 4 |
|
|
|
|
{ |
|
|
|
|
const size_t n = 100; |
|
|
|
|
std::vector<Thread> vt(n); |
|
|
|
|
for (size_t i = 0; i < n; i++) { |
|
|
|
|
vt[i].run(blsInit, MCL_BN254, MCLBN_COMPILED_TIME_VAR); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
CYBOZU_TEST_EQUAL(blsGetOpUnitSize(), 4u); |
|
|
|
|
#endif |
|
|
|
|
#if MCLBN_FP_UNIT_SIZE == 6 |
|
|
|
|
{ |
|
|
|
|
const size_t n = 100; |
|
|
|
|
std::vector<Thread> vt(n); |
|
|
|
|
for (size_t i = 0; i < n; i++) { |
|
|
|
|
vt[i].run(blsInit, MCL_BLS12_381, MCLBN_COMPILED_TIME_VAR); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
CYBOZU_TEST_EQUAL(blsGetOpUnitSize(), 6u); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
void blsSerializeTest() |
|
|
|
|
{ |
|
|
|
|
const size_t FrSize = blsGetFrByteSize(); |
|
|
|
|