summaryrefslogtreecommitdiffhomepage
path: root/test/rope_test/crope.pred.test.cpp
blob: ba433311dc7de5f9d4637c1da683c0d61a50fbf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
 * File: crope.pred.test.cpp
 * Purpose: Char rope test.
 * Author: Amlal El Mahrouss (amlal@nekernel.org)
 * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License.
 */

#include <ocl/tproc/rope.hpp>

#define BOOST_TEST_MODULE crope_pred
#include <boost/test/included/unit_test.hpp>

BOOST_AUTO_TEST_CASE(rope_should_succeed_in_empty_pred)
{
	auto rope = ocl::tproc::crope("");
	auto it	  = ocl::tproc::rope::find(rope.cbegin(), rope.cend(), ocl::tproc::rope::exact_pred("foo"));
	BOOST_TEST(it == rope.cend());
}

BOOST_AUTO_TEST_CASE(rope_should_not_succeed_in_empty_pred)
{
	auto rope = ocl::tproc::crope("foobar");

	// find the leaf with the exact value 'foo'
	auto it = ocl::tproc::rope::find(rope.cbegin(), rope.cend(), ocl::tproc::rope::starts_with_pred("foo"));
	BOOST_TEST(it != rope.cend());
}