aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/testContractionState.cxx1
-rw-r--r--test/unit/testPartitioning.cxx1
-rw-r--r--test/unit/testRunStyles.cxx1
-rw-r--r--test/unit/testSparseVector.cxx9
-rw-r--r--test/unit/testSplitVector.cxx13
5 files changed, 19 insertions, 6 deletions
diff --git a/test/unit/testContractionState.cxx b/test/unit/testContractionState.cxx
index 989aa409d..8b401dcb6 100644
--- a/test/unit/testContractionState.cxx
+++ b/test/unit/testContractionState.cxx
@@ -3,6 +3,7 @@
#include <cstring>
#include <stdexcept>
+#include <vector>
#include <algorithm>
#include <memory>
diff --git a/test/unit/testPartitioning.cxx b/test/unit/testPartitioning.cxx
index 008c140d8..925cc9a32 100644
--- a/test/unit/testPartitioning.cxx
+++ b/test/unit/testPartitioning.cxx
@@ -3,6 +3,7 @@
#include <cstring>
#include <stdexcept>
+#include <vector>
#include <algorithm>
#include <memory>
diff --git a/test/unit/testRunStyles.cxx b/test/unit/testRunStyles.cxx
index 72840322c..e33cedb2e 100644
--- a/test/unit/testRunStyles.cxx
+++ b/test/unit/testRunStyles.cxx
@@ -3,6 +3,7 @@
#include <cstring>
#include <stdexcept>
+#include <vector>
#include <algorithm>
#include <memory>
diff --git a/test/unit/testSparseVector.cxx b/test/unit/testSparseVector.cxx
index ad0110ae0..16498397a 100644
--- a/test/unit/testSparseVector.cxx
+++ b/test/unit/testSparseVector.cxx
@@ -4,6 +4,7 @@
#include <cstring>
#include <stdexcept>
+#include <vector>
#include <algorithm>
#include <memory>
@@ -45,9 +46,9 @@ TEST_CASE("SparseVector") {
SECTION("InsertSpace") {
st.InsertSpace(0, 5);
REQUIRE(1 == st.Elements());
- REQUIRE(static_cast<const char *>(NULL) == st.ValueAt(0));
- REQUIRE(static_cast<const char *>(NULL) == st.ValueAt(1));
- REQUIRE(static_cast<const char *>(NULL) == st.ValueAt(4));
+ REQUIRE(static_cast<const char *>(nullptr) == st.ValueAt(0));
+ REQUIRE(static_cast<const char *>(nullptr) == st.ValueAt(1));
+ REQUIRE(static_cast<const char *>(nullptr) == st.ValueAt(4));
st.Check();
}
@@ -119,7 +120,7 @@ TEST_CASE("SparseVector") {
st.SetValueAt(4, "5");
REQUIRE(2 == st.Elements());
REQUIRE("----5" == Representation(st));
- st.SetValueAt(4, NULL);
+ st.SetValueAt(4, nullptr);
REQUIRE(1 == st.Elements());
REQUIRE("-----" == Representation(st));
st.Check();
diff --git a/test/unit/testSplitVector.cxx b/test/unit/testSplitVector.cxx
index 3af51c45e..e01810d33 100644
--- a/test/unit/testSplitVector.cxx
+++ b/test/unit/testSplitVector.cxx
@@ -3,6 +3,7 @@
#include <cstring>
#include <stdexcept>
+#include <vector>
#include <algorithm>
#include <memory>
@@ -280,11 +281,19 @@ TEST_CASE("SplitVector") {
}
SECTION("BufferPointer") {
+ // Low-level access to the data
sv.InsertFromArray(0, testArray, 0, lengthTestArray);
+ sv.Insert(0, 99); // This moves the gap so that BufferPointer() must also move
+ REQUIRE(1 == sv.GapPosition());
+ const int lengthAfterInsertion = 1 + lengthTestArray;
+ REQUIRE(lengthAfterInsertion == (sv.Length()));
int *retrievePointer = sv.BufferPointer();
- for (int i=0; i<sv.Length(); i++) {
- REQUIRE((i+3) == retrievePointer[i]);
+ for (int i=1; i<sv.Length(); i++) {
+ REQUIRE((i+3-1) == retrievePointer[i]);
}
+ REQUIRE(lengthAfterInsertion == sv.Length());
+ // Gap was moved to end.
+ REQUIRE(lengthAfterInsertion == sv.GapPosition());
}
SECTION("DeleteBackAndForth") {