Browse Source

Perform curve parameter initialization at start of gtest suite.

metaverse
Sean Bowe 8 years ago
parent
commit
ae6b333c75
  1. 7
      src/gtest/main.cpp
  2. 2
      src/gtest/test_circuit.cpp
  3. 2
      src/gtest/test_merkletree.cpp

7
src/gtest/main.cpp

@ -1,8 +1,15 @@
#include "gtest/gtest.h"
#include "crypto/common.h"
#include "libsnark/common/default_types/r1cs_ppzksnark_pp.hpp"
#include "libsnark/zk_proof_systems/ppzksnark/r1cs_ppzksnark/r1cs_ppzksnark.hpp"
int main(int argc, char **argv) {
assert(init_and_check_sodium() != -1);
libsnark::default_r1cs_ppzksnark_pp::init_public_params();
libsnark::inhibit_profiling_info = true;
libsnark::inhibit_profiling_counters = true;
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}

2
src/gtest/test_circuit.cpp

@ -35,7 +35,6 @@ void test_value_equals(uint64_t i) {
TEST(circuit, values)
{
default_r1cs_ppzksnark_pp::init_public_params();
typedef Fr<default_r1cs_ppzksnark_pp> FieldT;
test_value_equals<FieldT>(0);
test_value_equals<FieldT>(1);
@ -162,7 +161,6 @@ TEST(circuit, merkle_tree_gadget_weirdness)
behavior.
*/
default_r1cs_ppzksnark_pp::init_public_params();
typedef Fr<default_r1cs_ppzksnark_pp> FieldT;
// Test the normal case

2
src/gtest/test_merkletree.cpp

@ -170,8 +170,6 @@ void test_tree(Array root_tests, Array ser_tests, Array witness_ser_tests, Array
}
TEST(merkletree, vectors) {
libsnark::default_r1cs_ppzksnark_pp::init_public_params();
Array root_tests = read_json(std::string(json_tests::merkle_roots, json_tests::merkle_roots + sizeof(json_tests::merkle_roots)));
Array ser_tests = read_json(std::string(json_tests::merkle_serialization, json_tests::merkle_serialization + sizeof(json_tests::merkle_serialization)));
Array witness_ser_tests = read_json(std::string(json_tests::merkle_witness_serialization, json_tests::merkle_witness_serialization + sizeof(json_tests::merkle_witness_serialization)));

Loading…
Cancel
Save