unit tests: replace global var with lambda returning static local var

Fixes assertion failure (curstate == 1) in random.c in debug mode
This commit is contained in:
stoffu 2019-09-09 11:44:06 +09:00
parent d0d76f771a
commit fdc00d0906
No known key found for this signature in database
GPG key ID: 41DAB8343A9EC012
2 changed files with 9 additions and 9 deletions

View file

@ -32,10 +32,10 @@
#include "ringct/rctOps.h"
#include "ringct/multiexp.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());
#define TESTSCALAR []{ static const rct::key TESTSCALAR = rct::skGen(); return TESTSCALAR; }()
#define TESTPOW2SCALAR []{ 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}}; return TESTPOW2SCALAR; }()
#define TESTSMALLSCALAR []{ 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}}; return TESTSMALLSCALAR; }()
#define TESTPOINT []{ static const rct::key TESTPOINT = rct::scalarmultBase(rct::skGen()); return TESTPOINT; }()
static rct::key basic(const std::vector<rct::MultiexpData> &data)
{