mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 11:56:31 +02:00
unit_tests: add a few more multiexp unit tests
This commit is contained in:
parent
6526d87f17
commit
d0a0565f7d
@ -32,8 +32,10 @@
|
||||
#include "ringct/rctOps.h"
|
||||
#include "ringct/multiexp.h"
|
||||
|
||||
static const rct::key TESTSCALAR = rct::H;
|
||||
static const rct::key TESTPOINT = rct::scalarmultBase(rct::H);
|
||||
static const rct::key TESTSCALAR = rct::skGen();
|
||||
static const rct::key TESTPOW2SCALAR = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
static const rct::key TESTSMALLSCALAR = {{5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
|
||||
static const rct::key TESTPOINT = rct::scalarmultBase(rct::skGen());
|
||||
|
||||
static rct::key basic(const std::vector<rct::MultiexpData> &data)
|
||||
{
|
||||
@ -81,6 +83,54 @@ TEST(multiexp, pippenger_empty)
|
||||
ASSERT_TRUE(basic(data) == pippenger(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, bos_coster_zero_and_non_zero)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({rct::zero(), get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == bos_coster_heap_conv_robust(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, straus_zero_and_non_zero)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({rct::zero(), get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == straus(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, pippenger_zero_and_non_zero)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({rct::zero(), get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == pippenger(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, bos_coster_pow2_scalar)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({TESTPOW2SCALAR, get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSMALLSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == bos_coster_heap_conv_robust(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, straus_pow2_scalar)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({TESTPOW2SCALAR, get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSMALLSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == straus(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, pippenger_pow2_scalar)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
data.push_back({TESTPOW2SCALAR, get_p3(TESTPOINT)});
|
||||
data.push_back({TESTSMALLSCALAR, get_p3(TESTPOINT)});
|
||||
ASSERT_TRUE(basic(data) == pippenger(data));
|
||||
}
|
||||
|
||||
TEST(multiexp, bos_coster_only_zeroes)
|
||||
{
|
||||
std::vector<rct::MultiexpData> data;
|
||||
|
Loading…
Reference in New Issue
Block a user