]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/algorithm/test/empty_search_test.cpp
2 Copyright (c) Marshall Clow 2010-2012.
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 For more information, see http://www.boost.org
12 #include <boost/algorithm/searching/boyer_moore.hpp>
13 #include <boost/algorithm/searching/boyer_moore_horspool.hpp>
14 #include <boost/algorithm/searching/knuth_morris_pratt.hpp>
16 #define BOOST_TEST_MAIN
17 #include <boost/test/unit_test.hpp>
19 BOOST_AUTO_TEST_CASE( test_main
)
23 std::string
str ( "abc" );
25 // empty corpus, empty pattern
27 boost::algorithm::boyer_moore_search (
28 cs
.begin (), cs
.end (), estr
.begin (), estr
.end ())
29 == std::make_pair(cs
.begin(), cs
.begin())
33 boost::algorithm::boyer_moore_horspool_search (
34 cs
.begin (), cs
.end (), estr
.begin (), estr
.end ())
35 == std::make_pair(cs
.begin(), cs
.begin())
39 boost::algorithm::knuth_morris_pratt_search (
40 cs
.begin (), cs
.end (), estr
.begin (), estr
.end ())
41 == std::make_pair(cs
.begin(), cs
.begin())
44 // empty corpus, non-empty pattern
46 boost::algorithm::boyer_moore_search (
47 estr
.begin (), estr
.end (), str
.begin (), str
.end ())
48 == std::make_pair(estr
.end(), estr
.end())
52 boost::algorithm::boyer_moore_horspool_search (
53 estr
.begin (), estr
.end (), str
.begin (), str
.end ())
54 == std::make_pair(estr
.end(), estr
.end())
58 boost::algorithm::knuth_morris_pratt_search (
59 estr
.begin (), estr
.end (), str
.begin (), str
.end ())
60 == std::make_pair(estr
.end(), estr
.end())
63 // non-empty corpus, empty pattern
65 boost::algorithm::boyer_moore_search (
66 str
.begin (), str
.end (), estr
.begin (), estr
.end ())
67 == std::make_pair(str
.begin(), str
.begin())
71 boost::algorithm::boyer_moore_horspool_search (
72 str
.begin (), str
.end (), estr
.begin (), estr
.end ())
73 == std::make_pair(str
.begin(), str
.begin())
77 boost::algorithm::knuth_morris_pratt_search (
78 str
.begin (), str
.end (), estr
.begin (), estr
.end ())
79 == std::make_pair(str
.begin(), str
.begin())