1 //===- unittests/ADT/IListNodeTest.cpp - ilist_node unit tests ------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ADT/ilist_node.h"
10 #include "gtest/gtest.h"
11 #include <type_traits>
14 using namespace llvm::ilist_detail
;
23 TEST(IListNodeTest
, Options
) {
25 std::is_same
<compute_node_options
<Node
>::type
,
26 compute_node_options
<Node
, ilist_tag
<void>>::type
>::value
,
27 "default tag is void");
29 !std::is_same
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
30 compute_node_options
<Node
, ilist_tag
<void>>::type
>::value
,
31 "default tag is void, different from TagA");
33 !std::is_same
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
34 compute_node_options
<Node
, ilist_tag
<TagB
>>::type
>::value
,
38 compute_node_options
<Node
, ilist_sentinel_tracking
<false>>::type
,
39 compute_node_options
<Node
, ilist_sentinel_tracking
<false>,
40 ilist_tag
<void>>::type
>::value
,
41 "default tag is void, even with sentinel tracking off");
44 compute_node_options
<Node
, ilist_sentinel_tracking
<false>>::type
,
45 compute_node_options
<Node
, ilist_tag
<void>,
46 ilist_sentinel_tracking
<false>>::type
>::value
,
47 "order shouldn't matter");
50 compute_node_options
<Node
, ilist_sentinel_tracking
<true>>::type
,
51 compute_node_options
<Node
, ilist_sentinel_tracking
<true>,
52 ilist_tag
<void>>::type
>::value
,
53 "default tag is void, even with sentinel tracking on");
56 compute_node_options
<Node
, ilist_sentinel_tracking
<true>>::type
,
57 compute_node_options
<Node
, ilist_tag
<void>,
58 ilist_sentinel_tracking
<true>>::type
>::value
,
59 "order shouldn't matter");
62 compute_node_options
<Node
, ilist_sentinel_tracking
<true>,
63 ilist_tag
<TagA
>>::type
,
64 compute_node_options
<Node
, ilist_tag
<TagA
>,
65 ilist_sentinel_tracking
<true>>::type
>::value
,
66 "order shouldn't matter with real tags");