File indexing completed on 2026-06-21 07:47:46
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Geometry/BlueprintBuilder.hpp"
0012 #include "Acts/Geometry/BlueprintNode.hpp"
0013 #include "Acts/Geometry/ContainerBlueprintNode.hpp"
0014 #include "Acts/Geometry/LayerBlueprintNode.hpp"
0015
0016 #include <memory>
0017 #include <optional>
0018
0019 using namespace Acts::Experimental;
0020 using Acts::Experimental::detail::OnContainerMutatesContainer;
0021 using Acts::Experimental::detail::OnContainerReturnsNode;
0022 using Acts::Experimental::detail::OnLayerMutatesLayer;
0023 using Acts::Experimental::detail::OnLayerReturnsNode;
0024
0025 namespace ActsTests {
0026
0027
0028
0029
0030
0031
0032
0033
0034 using Element = int;
0035
0036
0037
0038
0039 [[maybe_unused]] auto oldStyleLayer =
0040 [](const std::optional<Element>&, std::shared_ptr<LayerBlueprintNode> layer)
0041 -> std::shared_ptr<LayerBlueprintNode> { return layer; };
0042 static_assert(OnLayerReturnsNode<Element, decltype(oldStyleLayer)>,
0043 "onLayer callback returning shared_ptr<LayerBlueprintNode> must "
0044 "remain accepted (backward compatibility)");
0045
0046
0047 [[maybe_unused]] auto newStyleLayer =
0048 [](const std::optional<Element>&, std::shared_ptr<LayerBlueprintNode> layer)
0049 -> std::shared_ptr<BlueprintNode> { return layer; };
0050 static_assert(OnLayerReturnsNode<Element, decltype(newStyleLayer)>,
0051 "onLayer callback returning shared_ptr<BlueprintNode> must be "
0052 "accepted");
0053
0054
0055 [[maybe_unused]] auto mutateLayer = [](const std::optional<Element>&,
0056 LayerBlueprintNode&) {};
0057 static_assert(OnLayerMutatesLayer<Element, decltype(mutateLayer)>,
0058 "void-returning in-place onLayer callback must be accepted");
0059 static_assert(!OnLayerReturnsNode<Element, decltype(mutateLayer)>,
0060 "void-returning callback must not match the node-returning form");
0061
0062
0063
0064
0065 [[maybe_unused]] auto oldStyleContainer =
0066 [](const Element&, std::shared_ptr<ContainerBlueprintNode> container)
0067 -> std::shared_ptr<ContainerBlueprintNode> { return container; };
0068 static_assert(
0069 OnContainerReturnsNode<Element, decltype(oldStyleContainer)>,
0070 "onContainer callback returning shared_ptr<ContainerBlueprintNode> must "
0071 "remain accepted (backward compatibility)");
0072
0073
0074 [[maybe_unused]] auto newStyleContainer =
0075 [](const Element&, std::shared_ptr<ContainerBlueprintNode> container)
0076 -> std::shared_ptr<BlueprintNode> { return container; };
0077 static_assert(
0078 OnContainerReturnsNode<Element, decltype(newStyleContainer)>,
0079 "onContainer callback returning shared_ptr<BlueprintNode> must be "
0080 "accepted");
0081
0082
0083 [[maybe_unused]] auto mutateContainer = [](const Element&,
0084 ContainerBlueprintNode&) {};
0085 static_assert(OnContainerMutatesContainer<Element, decltype(mutateContainer)>,
0086 "void-returning in-place onContainer callback must be accepted");
0087 static_assert(!OnContainerReturnsNode<Element, decltype(mutateContainer)>,
0088 "void-returning callback must not match the node-returning form");
0089
0090 BOOST_AUTO_TEST_SUITE(GeometrySuite)
0091
0092 BOOST_AUTO_TEST_CASE(CustomizerReturnTypeBackwardCompatibility) {
0093
0094
0095 BOOST_CHECK(true);
0096 }
0097
0098 BOOST_AUTO_TEST_SUITE_END()
0099
0100 }