From 6dfd7f10f0c14f1f439934b29438f3ba473a2d95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 15 May 2023 22:56:37 +0200 Subject: [PATCH] core: Extend attribute container serialization test for a vector of tuples --- .../test/attribute-container-test-suite.cc | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/core/test/attribute-container-test-suite.cc b/src/core/test/attribute-container-test-suite.cc index dc49cfcf3..6872aa453 100644 --- a/src/core/test/attribute-container-test-suite.cc +++ b/src/core/test/attribute-container-test-suite.cc @@ -26,7 +26,9 @@ #include #include #include +#include #include +#include #include #include @@ -396,6 +398,24 @@ AttributeContainerSerializationTestCase::DoRun() std::string reserialized = attr.SerializeToString(checker); NS_TEST_ASSERT_MSG_EQ(reserialized, pairs, "Reserialization failed"); } + + { + std::string tupleVec = "{-1, 2, 3.4};{-2, 1, 4.3}"; + AttributeContainerValue, ';'> attr; + auto checker = MakeAttributeContainerChecker(attr); + auto acchecker = DynamicCast(checker); + acchecker->SetItemChecker(MakeTupleChecker( + MakeIntegerChecker(), + MakeUintegerChecker(), + MakeDoubleChecker())); + NS_TEST_ASSERT_MSG_EQ(attr.DeserializeFromString(tupleVec, checker), + true, + "Deserialization failed"); + NS_TEST_ASSERT_MSG_EQ(attr.GetN(), 2, "Incorrect container size"); + + std::string reserialized = attr.SerializeToString(checker); + NS_TEST_ASSERT_MSG_EQ(reserialized, tupleVec, "Reserialization failed"); + } } /**