diff --git a/projects/dataclasses/private/test/InteractionRecord_TEST.cxx b/projects/dataclasses/private/test/InteractionRecord_TEST.cxx index 0009a27e..be7a29c9 100644 --- a/projects/dataclasses/private/test/InteractionRecord_TEST.cxx +++ b/projects/dataclasses/private/test/InteractionRecord_TEST.cxx @@ -46,6 +46,11 @@ TEST(Comparison, Comparison_equal) B.signature.secondary_types.push_back(Particle::ParticleType::EMinus); EXPECT_TRUE(A == B); + A.primary_id = ParticleID(1, 1); + EXPECT_FALSE(A == B); + B.primary_id = ParticleID(1, 1); + EXPECT_TRUE(A == B); + A.primary_initial_position = {1.0, 2.0, 3.0}; EXPECT_FALSE(A == B); B.primary_initial_position = {1.0, 2.0, 3.0}; @@ -144,6 +149,14 @@ TEST(Comparison, LessThan) EXPECT_FALSE(A < B); EXPECT_FALSE(B < A); + A.primary_id = ParticleID(1, 1); + EXPECT_FALSE(A < B); + EXPECT_TRUE(B < A); + + B.primary_id = ParticleID(1, 1); + EXPECT_FALSE(A < B); + EXPECT_FALSE(B < A); + A.primary_initial_position = {1.0, 2.0, 3.0}; EXPECT_FALSE(A < B); EXPECT_TRUE(B < A); @@ -255,6 +268,8 @@ TEST(Serialization, Save) record.signature.primary_type = Particle::ParticleType::EMinus; record.signature.target_type = Particle::ParticleType::PPlus; record.signature.secondary_types.push_back(Particle::ParticleType::EMinus); + record.primary_id = ParticleID(1, 1); + record.primary_initial_position = {1.0, 2.0, 3.0}; record.primary_mass = 1.0; record.primary_momentum = {1.0, 2.0, 3.0, 4.0}; record.primary_helicity = 1.0; @@ -274,7 +289,77 @@ TEST(Serialization, Save) oarchive(record); } - std::string expected = "{\n \"cereal_class_version\": 0,\n \"InteractionSignature\": {\n \"cereal_class_version\": 0,\n \"PrimaryType\": -11,\n \"TargetType\": 2212,\n \"SecondaryTypes\": [\n -11\n ]\n },\n \"PrimaryInitialPosition\": [\n 1,\n 2,\n 3\n ],\n \"PrimaryMass\": 1,\n \"PrimaryMomentum\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"PrimaryHelicity\": 1,\n \"TargetMass\": 1,\n \"TargetMomentum\": [\n 1,\n 2,\n 3,\n 4\n ],\n \"TargetHelicity\": 1,\n \"InteractionVertex\": [\n 1,\n 2,\n 3\n ],\n \"SecondaryMasses\": [\n 1\n ],\n \"SecondaryMomenta\": [\n [\n 1,\n 2,\n 3,\n 4\n ]\n ],\n \"SecondaryHelicity\": [\n 1\n ],\n \"InteractionParameters\": {\n \"test\": 1\n }\n}"; + std::string expected = "{\n\ + \"value0\": {\n\ + \"cereal_class_version\": 0,\n\ + \"InteractionSignature\": {\n\ + \"cereal_class_version\": 0,\n\ + \"PrimaryType\": 11,\n\ + \"TargetType\": 2212,\n\ + \"SecondaryTypes\": [\n\ + 11\n\ + ]\n\ + },\n\ + \"PrimaryID\": {\n\ + \"cereal_class_version\": 0,\n\ + \"MajorID\": 1,\n\ + \"MinorID\": 1\n\ + },\n\ + \"PrimaryInitialPosition\": [\n\ + 1.0,\n\ + 2.0,\n\ + 3.0\n\ + ],\n\ + \"PrimaryMass\": 1.0,\n\ + \"PrimaryMomentum\": [\n\ + 1.0,\n\ + 2.0,\n\ + 3.0,\n\ + 4.0\n\ + ],\n\ + \"PrimaryHelicity\": 1.0,\n\ + \"TargetID\": {\n\ + \"MajorID\": 0,\n\ + \"MinorID\": 0\n\ + },\n\ + \"TargetMass\": 1.0,\n\ + \"TargetMomentum\": [\n\ + 1.0,\n\ + 2.0,\n\ + 3.0,\n\ + 4.0\n\ + ],\n\ + \"TargetHelicity\": 1.0,\n\ + \"InteractionVertex\": [\n\ + 1.0,\n\ + 2.0,\n\ + 3.0\n\ + ],\n\ + \"SecondaryIDs\": [],\n\ + \"SecondaryMasses\": [\n\ + 1.0\n\ + ],\n\ + \"SecondaryMomenta\": [\n\ + [\n\ + 1.0,\n\ + 2.0,\n\ + 3.0,\n\ + 4.0\n\ + ]\n\ + ],\n\ + \"SecondaryHelicity\": [\n\ + 1.0\n\ + ],\n\ + \"InteractionParameters\": [\n\ + {\n\ + \"key\": \"test\",\n\ + \"value\": 1.0\n\ + }\n\ + ]\n\ + }\n\ +}"; + + EXPECT_EQ(ss.str(), expected); } int main(int argc, char** argv)