From dbfbab069a35f3a61932915d35b3895e784b05de Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 12 Mar 2026 06:03:28 +0100 Subject: [CHORE] Add more unit tests for TProc. Signed-off-by: Amlal El Mahrouss --- test/rope_test/Jamfile.v2 | 4 ++++ test/rope_test/crope.pred.test.cpp | 20 ++++---------------- test/rope_test/crope.pred2.test.cpp | 12 +++++++++--- 3 files changed, 17 insertions(+), 19 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 : 20 ; +exe crope.pred2.test.o + : crope.pred2.test.cpp + : 20 ; + diff --git a/test/rope_test/crope.pred.test.cpp b/test/rope_test/crope.pred.test.cpp index 58424cc..d80e9ba 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) { 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{"The Quick"}(rope.begin(), rope.end()); - - BOOST_TEST(it != rope.cend()); - - auto it_end = tproc::rope::ends_with_pred{"Lazy Dog"}(rope.begin(), rope.end()); - - BOOST_TEST(it_end != rope.cend()); - std::unique_ptr new_elem = std::make_unique(", and Jumps again."); std::unique_ptr ret_elem(rope.concat(new_elem.get())); BOOST_TEST((*ret_elem == "The Quick Brown Fox Jumps Over The Lazy Dog, and Jumps again.")); - - std::cout << *ret_elem; + BOOST_TEST((rope == ", 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 #include -#define BOOST_TEST_MODULE crope_pred +#define BOOST_TEST_MODULE crope_pred2 #include #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(" Sentence"); + auto rope_2 = rope.concat(next_rope.get()); + + std::cout << "Result: " << rope << std::endl; + + BOOST_TEST(rope.to_string() == "Exact Sentence"); } -- cgit v1.2.3