Add another pq_factorize test.
This commit is contained in:
parent
dfe41c9a0d
commit
2ae689f54f
@ -36,20 +36,26 @@ static td::vector<td::uint64> gen_primes(td::uint64 L, td::uint64 R, std::size_t
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static td::vector<td::uint64> gen_primes() {
|
static td::vector<td::uint64> gen_primes(int mode) {
|
||||||
td::vector<td::uint64> result;
|
td::vector<td::uint64> result;
|
||||||
td::append(result, gen_primes(1, 100));
|
if (mode == 1) {
|
||||||
td::append(result, gen_primes((1ull << 31) - 500000, std::numeric_limits<td::uint64>::max(), 5));
|
for (size_t i = 10; i <= 19; i++) {
|
||||||
td::append(result, gen_primes((1ull << 32) - 500000, std::numeric_limits<td::uint64>::max(), 5));
|
td::append(result, gen_primes(i * 100000000, (i + 1) * 100000000, 1));
|
||||||
td::append(result, gen_primes((1ull << 39) - 500000, std::numeric_limits<td::uint64>::max(), 1));
|
}
|
||||||
|
} else {
|
||||||
|
td::append(result, gen_primes(1, 100));
|
||||||
|
td::append(result, gen_primes((1ull << 31) - 500000, std::numeric_limits<td::uint64>::max(), 5));
|
||||||
|
td::append(result, gen_primes((1ull << 32) - 500000, std::numeric_limits<td::uint64>::max(), 2));
|
||||||
|
td::append(result, gen_primes((1ull << 39) - 500000, std::numeric_limits<td::uint64>::max(), 1));
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
using PqQuery = std::pair<td::uint64, td::uint64>;
|
using PqQuery = std::pair<td::uint64, td::uint64>;
|
||||||
|
|
||||||
static td::vector<PqQuery> gen_pq_queries() {
|
static td::vector<PqQuery> gen_pq_queries(int mode = 0) {
|
||||||
td::vector<PqQuery> res;
|
td::vector<PqQuery> res;
|
||||||
auto primes = gen_primes();
|
auto primes = gen_primes(mode);
|
||||||
for (auto q : primes) {
|
for (auto q : primes) {
|
||||||
for (auto p : primes) {
|
for (auto p : primes) {
|
||||||
if (p > q) {
|
if (p > q) {
|
||||||
@ -139,6 +145,13 @@ TEST(CryptoPQ, generated_fast) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(CryptoPQ, generated_server) {
|
||||||
|
auto queries = gen_pq_queries(1);
|
||||||
|
for (const auto &query : queries) {
|
||||||
|
test_pq_fast(query.first, query.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#if TD_HAVE_OPENSSL
|
#if TD_HAVE_OPENSSL
|
||||||
TEST(CryptoPQ, generated_slow) {
|
TEST(CryptoPQ, generated_slow) {
|
||||||
auto queries = gen_pq_queries();
|
auto queries = gen_pq_queries();
|
||||||
|
Loading…
Reference in New Issue
Block a user