diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit_tests/ringct.cpp | 55 | ||||
-rw-r--r-- | tests/unit_tests/serialization.cpp | 25 |
2 files changed, 41 insertions, 39 deletions
diff --git a/tests/unit_tests/ringct.cpp b/tests/unit_tests/ringct.cpp index 5be74ec7e..16234ce52 100644 --- a/tests/unit_tests/ringct.cpp +++ b/tests/unit_tests/ringct.cpp @@ -985,18 +985,19 @@ TEST(ringct, rctSig_##name) \ ASSERT_FALSE(rct::verRct(sig)); \ } -TEST_rctSig_elements(rangeSigs_empty, sig.rangeSigs.resize(0)); -TEST_rctSig_elements(rangeSigs_too_many, sig.rangeSigs.push_back(sig.rangeSigs.back())); -TEST_rctSig_elements(rangeSigs_too_few, sig.rangeSigs.pop_back()); -TEST_rctSig_elements(mgSig_ss_empty, sig.MG.ss.resize(0)); -TEST_rctSig_elements(mgSig_ss_too_many, sig.MG.ss.push_back(sig.MG.ss.back())); -TEST_rctSig_elements(mgSig_ss_too_few, sig.MG.ss.pop_back()); -TEST_rctSig_elements(mgSig_ss0_empty, sig.MG.ss[0].resize(0)); -TEST_rctSig_elements(mgSig_ss0_too_many, sig.MG.ss[0].push_back(sig.MG.ss[0].back())); -TEST_rctSig_elements(mgSig_ss0_too_few, sig.MG.ss[0].pop_back()); -TEST_rctSig_elements(mgSig_II_empty, sig.MG.II.resize(0)); -TEST_rctSig_elements(mgSig_II_too_many, sig.MG.II.push_back(sig.MG.II.back())); -TEST_rctSig_elements(mgSig_II_too_few, sig.MG.II.pop_back()); +TEST_rctSig_elements(rangeSigs_empty, sig.p.rangeSigs.resize(0)); +TEST_rctSig_elements(rangeSigs_too_many, sig.p.rangeSigs.push_back(sig.p.rangeSigs.back())); +TEST_rctSig_elements(rangeSigs_too_few, sig.p.rangeSigs.pop_back()); +TEST_rctSig_elements(mgSig_MG_empty, sig.p.MGs.resize(0)); +TEST_rctSig_elements(mgSig_ss_empty, sig.p.MGs[0].ss.resize(0)); +TEST_rctSig_elements(mgSig_ss_too_many, sig.p.MGs[0].ss.push_back(sig.p.MGs[0].ss.back())); +TEST_rctSig_elements(mgSig_ss_too_few, sig.p.MGs[0].ss.pop_back()); +TEST_rctSig_elements(mgSig_ss0_empty, sig.p.MGs[0].ss[0].resize(0)); +TEST_rctSig_elements(mgSig_ss0_too_many, sig.p.MGs[0].ss[0].push_back(sig.p.MGs[0].ss[0].back())); +TEST_rctSig_elements(mgSig_ss0_too_few, sig.p.MGs[0].ss[0].pop_back()); +TEST_rctSig_elements(mgSig_II_empty, sig.p.MGs[0].II.resize(0)); +TEST_rctSig_elements(mgSig_II_too_many, sig.p.MGs[0].II.push_back(sig.p.MGs[0].II.back())); +TEST_rctSig_elements(mgSig_II_too_few, sig.p.MGs[0].II.pop_back()); TEST_rctSig_elements(mixRing_empty, sig.mixRing.resize(0)); TEST_rctSig_elements(mixRing_too_many, sig.mixRing.push_back(sig.mixRing.back())); TEST_rctSig_elements(mixRing_too_few, sig.mixRing.pop_back()); @@ -1021,21 +1022,21 @@ TEST(ringct, rctSig_##name##_simple) \ ASSERT_FALSE(rct::verRctSimple(sig)); \ } -TEST_rctSig_elements_simple(rangeSigs_empty, sig.rangeSigs.resize(0)); -TEST_rctSig_elements_simple(rangeSigs_too_many, sig.rangeSigs.push_back(sig.rangeSigs.back())); -TEST_rctSig_elements_simple(rangeSigs_too_few, sig.rangeSigs.pop_back()); -TEST_rctSig_elements_simple(mgSig_empty, sig.MGs.resize(0)); -TEST_rctSig_elements_simple(mgSig_too_many, sig.MGs.push_back(sig.MGs.back())); -TEST_rctSig_elements_simple(mgSig_too_few, sig.MGs.pop_back()); -TEST_rctSig_elements_simple(mgSig0_ss_empty, sig.MGs[0].ss.resize(0)); -TEST_rctSig_elements_simple(mgSig0_ss_too_many, sig.MGs[0].ss.push_back(sig.MGs[0].ss.back())); -TEST_rctSig_elements_simple(mgSig0_ss_too_few, sig.MGs[0].ss.pop_back()); -TEST_rctSig_elements_simple(mgSig_ss0_empty, sig.MGs[0].ss[0].resize(0)); -TEST_rctSig_elements_simple(mgSig_ss0_too_many, sig.MGs[0].ss[0].push_back(sig.MGs[0].ss[0].back())); -TEST_rctSig_elements_simple(mgSig_ss0_too_few, sig.MGs[0].ss[0].pop_back()); -TEST_rctSig_elements_simple(mgSig0_II_empty, sig.MGs[0].II.resize(0)); -TEST_rctSig_elements_simple(mgSig0_II_too_many, sig.MGs[0].II.push_back(sig.MGs[0].II.back())); -TEST_rctSig_elements_simple(mgSig0_II_too_few, sig.MGs[0].II.pop_back()); +TEST_rctSig_elements_simple(rangeSigs_empty, sig.p.rangeSigs.resize(0)); +TEST_rctSig_elements_simple(rangeSigs_too_many, sig.p.rangeSigs.push_back(sig.p.rangeSigs.back())); +TEST_rctSig_elements_simple(rangeSigs_too_few, sig.p.rangeSigs.pop_back()); +TEST_rctSig_elements_simple(mgSig_empty, sig.p.MGs.resize(0)); +TEST_rctSig_elements_simple(mgSig_too_many, sig.p.MGs.push_back(sig.p.MGs.back())); +TEST_rctSig_elements_simple(mgSig_too_few, sig.p.MGs.pop_back()); +TEST_rctSig_elements_simple(mgSig0_ss_empty, sig.p.MGs[0].ss.resize(0)); +TEST_rctSig_elements_simple(mgSig0_ss_too_many, sig.p.MGs[0].ss.push_back(sig.p.MGs[0].ss.back())); +TEST_rctSig_elements_simple(mgSig0_ss_too_few, sig.p.MGs[0].ss.pop_back()); +TEST_rctSig_elements_simple(mgSig_ss0_empty, sig.p.MGs[0].ss[0].resize(0)); +TEST_rctSig_elements_simple(mgSig_ss0_too_many, sig.p.MGs[0].ss[0].push_back(sig.p.MGs[0].ss[0].back())); +TEST_rctSig_elements_simple(mgSig_ss0_too_few, sig.p.MGs[0].ss[0].pop_back()); +TEST_rctSig_elements_simple(mgSig0_II_empty, sig.p.MGs[0].II.resize(0)); +TEST_rctSig_elements_simple(mgSig0_II_too_many, sig.p.MGs[0].II.push_back(sig.p.MGs[0].II.back())); +TEST_rctSig_elements_simple(mgSig0_II_too_few, sig.p.MGs[0].II.pop_back()); TEST_rctSig_elements_simple(mixRing_empty, sig.mixRing.resize(0)); TEST_rctSig_elements_simple(mixRing_too_many, sig.mixRing.push_back(sig.mixRing.back())); TEST_rctSig_elements_simple(mixRing_too_few, sig.mixRing.pop_back()); diff --git a/tests/unit_tests/serialization.cpp b/tests/unit_tests/serialization.cpp index 039c26fc0..40209f6ed 100644 --- a/tests/unit_tests/serialization.cpp +++ b/tests/unit_tests/serialization.cpp @@ -571,7 +571,7 @@ TEST(Serialization, serializes_ringct_types) //compute rct data with mixin 500 s0 = rct::genRct(rct::zero(), sc, pc, destinations, amounts, amount_keys, 3); - mg0 = s0.MG; + mg0 = s0.p.MGs[0]; ASSERT_TRUE(serialization::dump_binary(mg0, blob)); ASSERT_TRUE(serialization::parse_binary(blob, mg1)); ASSERT_TRUE(mg0.ss.size() == mg1.ss.size()); @@ -584,7 +584,7 @@ TEST(Serialization, serializes_ringct_types) // mixRing and II are not serialized, they are meant to be reconstructed ASSERT_TRUE(mg1.II.empty()); - rg0 = s0.rangeSigs.front(); + rg0 = s0.p.rangeSigs.front(); ASSERT_TRUE(serialization::dump_binary(rg0, blob)); ASSERT_TRUE(serialization::parse_binary(blob, rg1)); ASSERT_TRUE(!memcmp(&rg0, &rg1, sizeof(rg0))); @@ -592,19 +592,20 @@ TEST(Serialization, serializes_ringct_types) ASSERT_TRUE(serialization::dump_binary(s0, blob)); ASSERT_TRUE(serialization::parse_binary(blob, s1)); ASSERT_TRUE(s0.type == s1.type); - ASSERT_TRUE(s0.rangeSigs.size() == s1.rangeSigs.size()); - for (size_t n = 0; n < s0.rangeSigs.size(); ++n) + ASSERT_TRUE(s0.p.rangeSigs.size() == s1.p.rangeSigs.size()); + for (size_t n = 0; n < s0.p.rangeSigs.size(); ++n) { - ASSERT_TRUE(!memcmp(&s0.rangeSigs[n], &s1.rangeSigs[n], sizeof(s0.rangeSigs[n]))); + ASSERT_TRUE(!memcmp(&s0.p.rangeSigs[n], &s1.p.rangeSigs[n], sizeof(s0.p.rangeSigs[n]))); } - ASSERT_TRUE(s0.MG.ss.size() == s1.MG.ss.size()); - for (size_t n = 0; n < s0.MG.ss.size(); ++n) + ASSERT_TRUE(s0.p.MGs.size() == s1.p.MGs.size()); + ASSERT_TRUE(s0.p.MGs[0].ss.size() == s1.p.MGs[0].ss.size()); + for (size_t n = 0; n < s0.p.MGs[0].ss.size(); ++n) { - ASSERT_TRUE(s0.MG.ss[n] == s1.MG.ss[n]); + ASSERT_TRUE(s0.p.MGs[0].ss[n] == s1.p.MGs[0].ss[n]); } - ASSERT_TRUE(s0.MG.cc == s1.MG.cc); + ASSERT_TRUE(s0.p.MGs[0].cc == s1.p.MGs[0].cc); // mixRing and II are not serialized, they are meant to be reconstructed - ASSERT_TRUE(s1.MGs[0].II.empty()); + ASSERT_TRUE(s1.p.MGs[0].II.empty()); // mixRing and II are not serialized, they are meant to be reconstructed ASSERT_TRUE(s1.mixRing.size() == 0); @@ -631,10 +632,10 @@ TEST(Serialization, serializes_ringct_types) tx0.vin.push_back(txin_to_key2); tx0.vout.push_back(cryptonote::tx_out()); tx0.rct_signatures = s0; - ASSERT_EQ(tx0.rct_signatures.rangeSigs.size(), 2); + ASSERT_EQ(tx0.rct_signatures.p.rangeSigs.size(), 2); ASSERT_TRUE(serialization::dump_binary(tx0, blob)); ASSERT_TRUE(serialization::parse_binary(blob, tx1)); - ASSERT_EQ(tx1.rct_signatures.rangeSigs.size(), 2); + ASSERT_EQ(tx1.rct_signatures.p.rangeSigs.size(), 2); std::string blob2; ASSERT_TRUE(serialization::dump_binary(tx1, blob2)); ASSERT_TRUE(blob == blob2); |