Add test for _reserver and _resize

This commit is contained in:
Patrick Pelissier committed 2021-10-09 17:25:43 +02:00
1 parent 7bf325f91a
commit d6a8a6d159
2 files changed
+24 -1

No files matched your search

+2
View File
@@ -58,4 +58,6 @@ void cmp_cont(array_int_t a, std::vector<int> b)
}
#define DEFAULT_NUMBER 1000000
#define HAVE_RESERVE
#define HAVE_RESIZE
#include "check-generic.hpp"
+22 -1
View File
@@ -44,7 +44,7 @@
#define CONT_NAME_(CONT_OPL) M_GET_NAME CONT_OPL
#define CONT_NAME CONT_NAME_(CONT_OPL)
#define MAX_TEST 25
#define MAX_TEST 28
#ifdef HAVE_REVERSE_IT
// Scan the C++ sequence in reverse
@@ -380,6 +380,27 @@ void test(int select_test, int index,
break;
#endif
#ifdef HAVE_RESIZE
case 25:
index = (1 + (c1.size() < 1000000)) * (index % ( c1.size() + 1) );
M_C(CONT_NAME, _resize)(c0, index);
c1.resize(index);
break;
#endif
#ifdef HAVE_RESERVE
case 26:
index = c1.size() + ( index % (c1.size() + 1) );
M_C(CONT_NAME, _reserve)(c0, index);
c1.reserve(index);
break;
case 27:
M_C(CONT_NAME, _reserve)(c0, 0);
c1.shrink_to_fit();
break;
#endif
// SPLICE_BACK
// SPLICE_AT
// Needs SPLICE ?