mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-11 05:23:52 +00:00
Added a CMake test.
This commit is contained in:
parent
d72d57fa39
commit
ae5d7d8c0c
20
.github/workflows/ci.yml
vendored
20
.github/workflows/ci.yml
vendored
@ -288,6 +288,10 @@ jobs:
|
|||||||
cxxstd: "11,14,17,2a"
|
cxxstd: "11,14,17,2a"
|
||||||
os: macos-11
|
os: macos-11
|
||||||
|
|
||||||
|
- name: CMake tests
|
||||||
|
cmake_tests: 1
|
||||||
|
os: ubuntu-20.04
|
||||||
|
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ${{matrix.os}}
|
runs-on: ${{matrix.os}}
|
||||||
container: ${{matrix.container}}
|
container: ${{matrix.container}}
|
||||||
@ -486,3 +490,19 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
B2_ARGS+=("libs/$LIBRARY/test")
|
B2_ARGS+=("libs/$LIBRARY/test")
|
||||||
./b2 "${B2_ARGS[@]}"
|
./b2 "${B2_ARGS[@]}"
|
||||||
|
|
||||||
|
- name: Run CMake tests
|
||||||
|
if: matrix.cmake_tests
|
||||||
|
run: |
|
||||||
|
if [ -n "${{matrix.macosx_version_min}}" ]
|
||||||
|
then
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET="${{matrix.macosx_version_min}}"
|
||||||
|
fi
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build_static__ && cd __build_static__
|
||||||
|
cmake ../libs/$LIBRARY/test/test_cmake
|
||||||
|
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
|
||||||
|
cd ..
|
||||||
|
mkdir __build_shared__ && cd __build_shared__
|
||||||
|
cmake -DBUILD_SHARED_LIBS=On ../libs/$LIBRARY/test/test_cmake
|
||||||
|
cmake --build . --target boost_${LIBRARY}_cmake_self_test -j $BUILD_JOBS
|
||||||
|
16
appveyor.yml
16
appveyor.yml
@ -58,6 +58,8 @@ environment:
|
|||||||
CXXSTD: 11,14,1z
|
CXXSTD: 11,14,1z
|
||||||
ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;
|
ADDPATH: C:\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin;
|
||||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
|
- TEST_CMAKE: 1
|
||||||
|
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- set GIT_FETCH_JOBS=8
|
- set GIT_FETCH_JOBS=8
|
||||||
@ -84,3 +86,17 @@ test_script:
|
|||||||
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
- if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||||
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
- if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||||
- b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% %ADDRMD%
|
- b2 -j %NUMBER_OF_PROCESSORS% libs/iterator/test toolset=%TOOLSET% %CXXSTD% %ADDRMD%
|
||||||
|
|
||||||
|
for:
|
||||||
|
- matrix:
|
||||||
|
only: [TEST_CMAKE: 1]
|
||||||
|
test_script:
|
||||||
|
- mkdir __build_static__
|
||||||
|
- cd __build_static__
|
||||||
|
- cmake ../libs/iterator/test/test_cmake
|
||||||
|
- cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS%
|
||||||
|
- cd ..
|
||||||
|
- mkdir __build_shared__
|
||||||
|
- cd __build_shared__
|
||||||
|
- cmake -DBUILD_SHARED_LIBS=On ../libs/iterator/test/test_cmake
|
||||||
|
- cmake --build . --target boost_iterator_cmake_self_test -j %NUMBER_OF_PROCESSORS%
|
||||||
|
20
test/test_cmake/CMakeLists.txt
Normal file
20
test/test_cmake/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Copyright 2023 Andrey Semashev
|
||||||
|
#
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
#
|
||||||
|
# NOTE: This does NOT run the unit tests for Boost.Atomic.
|
||||||
|
# It only tests if the CMakeLists.txt file in its root works as expected
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
project(BoostIteratorCMakeSelfTest)
|
||||||
|
|
||||||
|
# Use experimental superproject to pull library dependencies recursively
|
||||||
|
set(BOOST_ENABLE_CMAKE 1)
|
||||||
|
add_subdirectory(../../../.. "${CMAKE_CURRENT_BINARY_DIR}/boost_superproject")
|
||||||
|
|
||||||
|
add_definitions(-DBOOST_ALL_NO_LIB)
|
||||||
|
|
||||||
|
add_executable(boost_iterator_cmake_self_test main.cpp)
|
||||||
|
target_link_libraries(boost_iterator_cmake_self_test Boost::iterator)
|
54
test/test_cmake/main.cpp
Normal file
54
test/test_cmake/main.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
// Copyright (c) 2023 Andrey Semashev
|
||||||
|
//
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#include <boost/generator_iterator.hpp>
|
||||||
|
#include <boost/indirect_reference.hpp>
|
||||||
|
#include <boost/next_prior.hpp>
|
||||||
|
#include <boost/pointee.hpp>
|
||||||
|
#include <boost/shared_container_iterator.hpp>
|
||||||
|
#include <boost/iterator/advance.hpp>
|
||||||
|
#include <boost/iterator/counting_iterator.hpp>
|
||||||
|
#include <boost/iterator/distance.hpp>
|
||||||
|
#include <boost/iterator/filter_iterator.hpp>
|
||||||
|
#include <boost/iterator/function_input_iterator.hpp>
|
||||||
|
#include <boost/iterator/function_output_iterator.hpp>
|
||||||
|
#include <boost/iterator/indirect_iterator.hpp>
|
||||||
|
#include <boost/iterator/interoperable.hpp>
|
||||||
|
#include <boost/iterator/is_iterator.hpp>
|
||||||
|
#include <boost/iterator/is_lvalue_iterator.hpp>
|
||||||
|
#include <boost/iterator/is_readable_iterator.hpp>
|
||||||
|
#include <boost/iterator/iterator_adaptor.hpp>
|
||||||
|
#include <boost/iterator/iterator_archetypes.hpp>
|
||||||
|
#include <boost/iterator/iterator_categories.hpp>
|
||||||
|
#include <boost/iterator/iterator_concepts.hpp>
|
||||||
|
#include <boost/iterator/iterator_facade.hpp>
|
||||||
|
#include <boost/iterator/iterator_traits.hpp>
|
||||||
|
#include <boost/iterator/minimum_category.hpp>
|
||||||
|
#include <boost/iterator/new_iterator_tests.hpp>
|
||||||
|
#include <boost/iterator/permutation_iterator.hpp>
|
||||||
|
#include <boost/iterator/reverse_iterator.hpp>
|
||||||
|
#include <boost/iterator/transform_iterator.hpp>
|
||||||
|
#include <boost/iterator/zip_iterator.hpp>
|
||||||
|
|
||||||
|
template< typename Iterator >
|
||||||
|
class adapted_iterator :
|
||||||
|
public boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator >
|
||||||
|
{
|
||||||
|
friend class iterator_core_access;
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef boost::iterators::iterator_adaptor< adapted_iterator< Iterator >, Iterator > base_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit adapted_iterator(Iterator it) : base_type(it) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
unsigned char buf[8];
|
||||||
|
adapted_iterator< unsigned char* > b(buf), e(buf + sizeof(buf));
|
||||||
|
return boost::iterators::distance(b, e) == static_cast< adapted_iterator< unsigned char* >::difference_type >(sizeof(buf));
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user