diff options
author | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2015-10-07 16:32:38 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhsoting.net> | 2015-10-07 16:32:38 +0200 |
commit | 6739f7a7e0858ecfcf83d9cb456f6edbb2fe4095 (patch) | |
tree | 71640ef65220bea8485726e701acda2fd2c74ed3 /test/test.cpp | |
parent | 0d83e41f90a523f69d8701fc218ce4c133eb53c6 (diff) | |
parent | d4ba486cc6aacbbed2be1e71ea77410052a22ac1 (diff) |
Merge tag 'upstream/0.8.3'
Upstream version 0.8.3
Diffstat (limited to 'test/test.cpp')
-rw-r--r-- | test/test.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
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())); |