diff -r 1f4f01870c1e -r 4fd76139b69e test/path_test.cc --- a/test/path_test.cc Sat Feb 17 23:44:15 2018 +0100 +++ b/test/path_test.cc Sat Feb 17 23:44:32 2018 +0100 @@ -108,6 +108,11 @@ checkBackAndFrontInsertablePath >(); checkBackInsertablePath >(); + checkSubscriptOperator >(); + checkSubscriptOperator >(); + checkSubscriptOperator >(); + checkSubscriptOperator >(); + checkListPathSplitAndSplice(); } @@ -273,6 +278,25 @@ check(checkPath(cgr, cp), "Wrong checkPath()"); } + template + void checkSubscriptOperator() { + SimplePath p0; + p0.addBack(a1); + p0.addBack(a3); + p0.addBack(a2); + P p = p0; + check(!p.empty(), "Wrong empty()"); + check(p.length() == 3, "Wrong length"); + check(p.front() == a1, "Wrong front()"); + check(p.back() == a2, "Wrong back()"); + check(p.nth(0) == a1, "Wrong nth()"); + check(p.nth(1) == a3, "Wrong nth()"); + check(p.nth(2) == a2, "Wrong nth()"); + check(p[0] == a1, "Wrong operator[]"); + check(p[1] == a3, "Wrong operator[]"); + check(p[2] == a2, "Wrong operator[]"); + } + void checkListPathSplitAndSplice() { // Build a path with spliceFront() and spliceBack()