aboutsummaryrefslogtreecommitdiffstats
path: root/libtransport/src
diff options
context:
space:
mode:
authorMauro Sardara <msardara@cisco.com>2021-01-26 19:01:02 +0100
committerMauro Sardara <msardara@cisco.com>2021-01-26 19:01:02 +0100
commitf77f2a01fb49b52f02d6493e926d0ccc41abf4d0 (patch)
tree80bf9d2a60f0106e94fd0b9a4d179274e1614015 /libtransport/src
parent14e1dcd14e73a699c94bdd883c34104daed0404a (diff)
[HICN-677] Fix compilation error for tests in ubuntu bionic.
Signed-off-by: Mauro Sardara <msardara@cisco.com> Change-Id: I5ee18d4039a40bf47e889b90748bdbd94987a5ed
Diffstat (limited to 'libtransport/src')
-rw-r--r--libtransport/src/test/test_core_manifest.cc43
1 files changed, 1 insertions, 42 deletions
diff --git a/libtransport/src/test/test_core_manifest.cc b/libtransport/src/test/test_core_manifest.cc
index c88ca347b..faf17dcf0 100644
--- a/libtransport/src/test/test_core_manifest.cc
+++ b/libtransport/src/test/test_core_manifest.cc
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
#include <hicn/transport/security/crypto_hash_type.h>
+#include <climits>
#include <random>
#include <vector>
@@ -197,48 +198,6 @@ TEST_F(ManifestTest, SetSuffixList) {
delete[] entries;
}
-TEST_F(ManifestTest, EstimateSize) {
- manifest1_.clear();
-
- auto hash1 = utils::CryptoHashType::SHA_256;
- NextSegmentCalculationStrategy strategy1 =
- NextSegmentCalculationStrategy::INCREMENTAL;
- ManifestType type1 = ManifestType::INLINE_MANIFEST;
- core::Name base_name1("b001:abcd:fede:baba:cece:d0d0:face:dead");
-
- manifest1_.setFinalManifest(true);
- manifest1_.setBaseName(base_name1);
- manifest1_.setNextSegmentCalculationStrategy(strategy1);
- manifest1_.setHashAlgorithm(hash1);
- manifest1_.setManifestType(type1);
-
- std::default_random_engine eng((std::random_device())());
- std::uniform_int_distribution<uint64_t> idis(
- 0, std::numeric_limits<uint64_t>::max());
-
- using random_bytes_engine =
- std::independent_bits_engine<std::default_random_engine, CHAR_BIT,
- unsigned char>;
- random_bytes_engine rbe;
-
- while (manifest1_.estimateManifestSize(1) < 1440) {
- uint32_t suffix = static_cast<std::uint32_t>(idis(eng));
- std::vector<unsigned char> data(32);
- std::generate(std::begin(data), std::end(data), std::ref(rbe));
- auto hash = utils::CryptoHash(data.data(), data.size(),
- utils::CryptoHashType::SHA_256);
- manifest1_.addSuffixHash(suffix, hash);
- }
-
- manifest1_.encode();
- manifest1_.decode();
-
- manifest1_.dump();
-
- ASSERT_GT(manifest1_.estimateManifestSize(), 0);
- ASSERT_LT(manifest1_.estimateManifestSize(), 1500);
-}
-
} // namespace core
} // namespace transport