Skip to content

Commit 9c94196

Browse files
committed
Add test/cmake_subdir_test
1 parent 55ded21 commit 9c94196

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2018, 2019 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.31)
6+
7+
project(cmake_subdir_test LANGUAGES CXX)
8+
9+
set(BOOST_INCLUDE_LIBRARIES range)
10+
add_subdirectory(../../../.. boostorg/boost)
11+
12+
add_executable(main main.cpp)
13+
target_link_libraries(main Boost::range)
14+
15+
enable_testing()
16+
add_test(main main)
17+
18+
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

test/cmake_subdir_test/main.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2026 Peter Dimov
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// http://www.boost.org/LICENSE_1_0.txt
4+
5+
#undef NDEBUG
6+
7+
#include <boost/range.hpp>
8+
#include <string>
9+
#include <cassert>
10+
11+
int main()
12+
{
13+
std::string s( "foo" );
14+
15+
assert( boost::begin( s ) == s.begin() );
16+
assert( boost::end( s ) == s.end() );
17+
assert( boost::empty( s ) == s.empty() );
18+
assert( boost::size( s ) == s.size() );
19+
}

0 commit comments

Comments
 (0)