summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/config.h.in3
-rw-r--r--test/test.cpp22
2 files changed, 19 insertions, 6 deletions
diff --git a/test/config.h.in b/test/config.h.in
index 1ffe789..b81315e 100644
--- a/test/config.h.in
+++ b/test/config.h.in
@@ -33,8 +33,7 @@
/* Define if your C runtime provides the wprintf function. */
#undef HAVE_WPRINTF
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
#undef LT_OBJDIR
/* Name of package */
diff --git a/test/test.cpp b/test/test.cpp
index 777f233..670aa07 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -1786,22 +1786,29 @@ Rule | Example | hostSet | absPath | emptySeg
testEqualsHelper("//host:123");
}
- void testCompareRangeHelper(const char * a, const char * b, int expected) {
+ void testCompareRangeHelper(const char * a, const char * b, int expected, bool avoidNullRange = true) {
UriTextRangeA ra;
UriTextRangeA rb;
if (a) {
ra.first = a;
ra.afterLast = a + strlen(a);
+ } else {
+ ra.first = NULL;
+ ra.afterLast = NULL;
}
+
if (b) {
rb.first = b;
rb.afterLast = b + strlen(b);
+ } else {
+ rb.first = NULL;
+ rb.afterLast = NULL;
}
const int received = uriCompareRangeA(
- (a == NULL) ? NULL : &ra,
- (b == NULL) ? NULL : &rb);
+ ((a == NULL) && avoidNullRange) ? NULL : &ra,
+ ((b == NULL) && avoidNullRange) ? NULL : &rb);
if (received != expected) {
printf("Comparing <%s> to <%s> yields %d, expected %d.\n",
a, b, received, expected);
@@ -1825,11 +1832,18 @@ Rule | Example | hostSet | absPath | emptySeg
testCompareRangeHelper(NULL, "a", -1);
testCompareRangeHelper("a", NULL, 1);
testCompareRangeHelper(NULL, NULL, 0);
+
+ // Fixed with 0.8.3
+ const bool KEEP_NULL_RANGE = false;
+ const bool AVOID_NULL_RANGE = true;
+ testCompareRangeHelper(NULL, "", -1, AVOID_NULL_RANGE);
+ testCompareRangeHelper(NULL, "", -1, KEEP_NULL_RANGE);
+ testCompareRangeHelper("", NULL, 1, AVOID_NULL_RANGE);
+ testCompareRangeHelper("", NULL, 1, KEEP_NULL_RANGE);
}
};
-
int main() {
Suite suite;
suite.add(auto_ptr<Suite>(new UriSuite()));