-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
245 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright 2018, 2019, 2022 Peter Dimov | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
cmake_minimum_required(VERSION 3.5...3.20) | ||
|
||
project(cmake_install_test LANGUAGES CXX) | ||
|
||
find_package(boost_describe REQUIRED) | ||
|
||
add_executable(main main.cpp) | ||
target_link_libraries(main Boost::describe) | ||
|
||
enable_testing() | ||
add_test(main main) | ||
|
||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2017, 2020, 2021, 2022 Peter Dimov. | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// https://www.boost.org/LICENSE_1_0.txt | ||
|
||
#include <boost/describe.hpp> | ||
#include <cassert> | ||
|
||
#define BOOST_TEST(expr) assert(expr) | ||
#define BOOST_TEST_EQ(x1, x2) assert((x1)==(x2)) | ||
|
||
struct X | ||
{ | ||
int m; | ||
}; | ||
|
||
BOOST_DESCRIBE_STRUCT(X, (), (m)) | ||
|
||
struct Y: public X | ||
{ | ||
void m() {} | ||
}; | ||
|
||
BOOST_DESCRIBE_STRUCT(Y, (X), (m)) | ||
|
||
#if !defined(BOOST_DESCRIBE_CXX14) | ||
|
||
#pragma message "Skipping test because C++14 is not available" | ||
|
||
int main() | ||
{ | ||
} | ||
|
||
#else | ||
|
||
BOOST_DEFINE_ENUM(E, v1, v2, v3) | ||
|
||
#include <boost/mp11.hpp> | ||
|
||
int main() | ||
{ | ||
using namespace boost::describe; | ||
using namespace boost::mp11; | ||
|
||
BOOST_TEST_EQ( (mp_size< describe_enumerators<E> >::value), 3 ); | ||
BOOST_TEST_EQ( (mp_size< describe_bases<Y, mod_any_access> >::value), 1 ); | ||
BOOST_TEST_EQ( (mp_size< describe_members<Y, mod_any_access | mod_inherited | mod_hidden> >::value), 1 ); | ||
} | ||
|
||
#endif // !defined(BOOST_DESCRIBE_CXX14) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2018-2022 Peter Dimov | ||
# Distributed under the Boost Software License, Version 1.0. | ||
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt | ||
|
||
cmake_minimum_required(VERSION 3.5...3.20) | ||
|
||
project(cmake_subdir_test LANGUAGES CXX) | ||
|
||
add_subdirectory(../.. boostorg/describe) | ||
add_subdirectory(../../../assert boostorg/assert) | ||
add_subdirectory(../../../config boostorg/config) | ||
add_subdirectory(../../../core boostorg/core) | ||
add_subdirectory(../../../mp11 boostorg/mp11) | ||
add_subdirectory(../../../static_assert boostorg/static_assert) | ||
add_subdirectory(../../../throw_exception boostorg/throw_exception) | ||
|
||
add_executable(quick ../quick.cpp) | ||
target_link_libraries(quick Boost::describe Boost::core) | ||
|
||
enable_testing() | ||
add_test(quick quick) | ||
|
||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure --no-tests=error -C $<CONFIG>) |