diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/rope_test/Jamfile.v2 | 4 | ||||
| -rw-r--r-- | test/rope_test/crope.pred.test.cpp | 26 | ||||
| -rw-r--r-- | test/rope_test/crope.pred2.test.cpp | 12 |
3 files changed, 20 insertions, 22 deletions
diff --git a/test/rope_test/Jamfile.v2 b/test/rope_test/Jamfile.v2 index 9c65363..45a2f64 100644 --- a/test/rope_test/Jamfile.v2 +++ b/test/rope_test/Jamfile.v2 @@ -17,4 +17,8 @@ exe crope.pred.test.o : crope.pred.test.cpp : <cxxstd>20 ; +exe crope.pred2.test.o + : crope.pred2.test.cpp + : <cxxstd>20 ; + diff --git a/test/rope_test/crope.pred.test.cpp b/test/rope_test/crope.pred.test.cpp index 58424cc..5505462 100644 --- a/test/rope_test/crope.pred.test.cpp +++ b/test/rope_test/crope.pred.test.cpp @@ -24,34 +24,22 @@ BOOST_AUTO_TEST_CASE(rope_should_succeed_in_find_pred) BOOST_TEST(it != rope.cend()); - std::cout << rope << std::endl; + std::cout << "Result: " << rope << std::endl; } BOOST_AUTO_TEST_CASE(rope_should_succeed_in_at) { auto rope = tproc::crope("Exact Sentence"); - auto it = std::move(rope.substr(rope.at("Exact"), rope.size())); - - BOOST_ASSERT(it == "Exact Sentence"); + BOOST_ASSERT(rope.to_string() == "Exact Sentence"); } -BOOST_AUTO_TEST_CASE(rope_should_succeed_in_starts_with) +BOOST_AUTO_TEST_CASE(rope_should_succeed_in_concat) { auto rope = tproc::crope("The Quick Brown Fox Jumps Over The Lazy Dog"); - - // find the leaf with the starting value 'foo' - auto it = tproc::rope::starts_with_pred<tproc::crope>{"The Quick"}(rope.begin(), rope.end()); - - BOOST_TEST(it != rope.cend()); - - auto it_end = tproc::rope::ends_with_pred<tproc::crope>{"Lazy Dog"}(rope.begin(), rope.end()); - - BOOST_TEST(it_end != rope.cend()); - std::unique_ptr<tproc::crope> new_elem = std::make_unique<tproc::crope>(", and Jumps again."); - std::unique_ptr<tproc::crope> ret_elem(rope.concat(new_elem.get())); - - BOOST_TEST((*ret_elem == "The Quick Brown Fox Jumps Over The Lazy Dog, and Jumps again.")); + rope.concat(new_elem.get()); - std::cout << *ret_elem; + BOOST_TEST((rope.to_string() == "The Quick Brown Fox Jumps Over The Lazy Dog, and Jumps again.")); + BOOST_TEST((new_elem->to_string() == ", and Jumps again.")); + std::cout << "Result: " << rope << std::endl; } diff --git a/test/rope_test/crope.pred2.test.cpp b/test/rope_test/crope.pred2.test.cpp index c2f5aca..9b9b333 100644 --- a/test/rope_test/crope.pred2.test.cpp +++ b/test/rope_test/crope.pred2.test.cpp @@ -8,7 +8,7 @@ #include <memory> #include <iostream> -#define BOOST_TEST_MODULE crope_pred +#define BOOST_TEST_MODULE crope_pred2 #include <boost/test/included/unit_test.hpp> #ifndef STANDALONE @@ -17,7 +17,13 @@ using namespace ocl; using namespace boost; #endif -BOOST_AUTO_TEST_CASE(rope_should_succeed_in_find_pred) +BOOST_AUTO_TEST_CASE(rope_should_succeed_in_concat) { - + auto rope = tproc::crope("Exact"); + auto next_rope = std::make_unique<tproc::crope>(" Sentence"); + auto rope_2 = rope.concat(next_rope.get()); + + std::cout << "Result: " << rope << std::endl; + + BOOST_TEST(rope.to_string() == "Exact Sentence"); } |
