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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
// Copyright 2021 Peter Dimov
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt
#include <boost/core/detail/string_view.hpp>
#include <boost/core/lightweight_test.hpp>
#include <stdexcept>
#include <cstddef>
int main()
{
{
boost::core::string_view sv( "" );
BOOST_TEST( sv.ends_with( boost::core::string_view() ) );
BOOST_TEST( sv.ends_with( boost::core::string_view( "" ) ) );
BOOST_TEST( sv.ends_with( "" ) );
BOOST_TEST( !sv.ends_with( boost::core::string_view( "1" ) ) );
BOOST_TEST( !sv.ends_with( '1' ) );
BOOST_TEST( !sv.ends_with( "1" ) );
}
{
boost::core::string_view sv( "123" );
BOOST_TEST( sv.ends_with( boost::core::string_view() ) );
BOOST_TEST( sv.ends_with( boost::core::string_view( "" ) ) );
BOOST_TEST( sv.ends_with( "" ) );
BOOST_TEST( sv.ends_with( boost::core::string_view( "3" ) ) );
BOOST_TEST( sv.ends_with( '3' ) );
BOOST_TEST( sv.ends_with( "3" ) );
BOOST_TEST( sv.ends_with( boost::core::string_view( "23" ) ) );
BOOST_TEST( sv.ends_with( "23" ) );
BOOST_TEST( sv.ends_with( boost::core::string_view( "123" ) ) );
BOOST_TEST( sv.ends_with( "123" ) );
BOOST_TEST( !sv.ends_with( boost::core::string_view( "1234" ) ) );
BOOST_TEST( !sv.ends_with( "1234" ) );
BOOST_TEST( !sv.ends_with( boost::core::string_view( "2" ) ) );
BOOST_TEST( !sv.ends_with( '2' ) );
BOOST_TEST( !sv.ends_with( "2" ) );
}
return boost::report_errors();
}
|