ims: prevent memory pool size from becoming zero
refs: #4769
Change-Id: Id1c1dadf40db6f62bd684391066e7ad45ec8dcd1
diff --git a/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp b/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
index a873de1..00cde40 100644
--- a/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
+++ b/tests/unit-tests/ims/in-memory-storage-fifo.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2013-2017 Regents of the University of California.
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -73,6 +73,21 @@
BOOST_CHECK(found2 == nullptr);
}
+BOOST_AUTO_TEST_CASE(MemoryPoolSizeZeroBug) // Bug #4769
+{
+ InMemoryStorageFifo ims;
+
+ BOOST_CHECK_EQUAL(ims.getCapacity(), 16);
+ for (int i = 1; i < 5; ++i) {
+ ims.insert(*makeData(to_string(i)));
+ ims.erase(Name(to_string(i)));
+ }
+
+ BOOST_CHECK_EQUAL(ims.getCapacity(), 16);
+ ims.insert(*makeData("/5"));
+ BOOST_CHECK_EQUAL(ims.getCapacity(), 16);
+}
+
BOOST_AUTO_TEST_SUITE_END() // TestInMemoryStorageFifo
BOOST_AUTO_TEST_SUITE_END() // Ims