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
;
25 TEST(IListNodeTest
, Options
) {
27 std::is_same_v
<compute_node_options
<Node
>::type
,
28 compute_node_options
<Node
, ilist_tag
<void>>::type
>,
29 "default tag is void");
31 !std::is_same_v
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
32 compute_node_options
<Node
, ilist_tag
<void>>::type
>,
33 "default tag is void, different from TagA");
35 !std::is_same_v
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
36 compute_node_options
<Node
, ilist_tag
<TagB
>>::type
>,
40 compute_node_options
<Node
, ilist_sentinel_tracking
<false>>::type
,
41 compute_node_options
<Node
, ilist_sentinel_tracking
<false>,
42 ilist_tag
<void>>::type
>,
43 "default tag is void, even with sentinel tracking off");
46 compute_node_options
<Node
, ilist_sentinel_tracking
<false>>::type
,
47 compute_node_options
<Node
, ilist_tag
<void>,
48 ilist_sentinel_tracking
<false>>::type
>,
49 "order shouldn't matter");
52 compute_node_options
<Node
, ilist_sentinel_tracking
<true>>::type
,
53 compute_node_options
<Node
, ilist_sentinel_tracking
<true>,
54 ilist_tag
<void>>::type
>,
55 "default tag is void, even with sentinel tracking on");
58 compute_node_options
<Node
, ilist_sentinel_tracking
<true>>::type
,
59 compute_node_options
<Node
, ilist_tag
<void>,
60 ilist_sentinel_tracking
<true>>::type
>,
61 "order shouldn't matter");
63 std::is_same_v
<compute_node_options
<Node
, ilist_sentinel_tracking
<true>,
64 ilist_tag
<TagA
>>::type
,
65 compute_node_options
<Node
, ilist_tag
<TagA
>,
66 ilist_sentinel_tracking
<true>>::type
>,
67 "order shouldn't matter with real tags");
69 std::is_same_v
<compute_node_options
<Node
>::type
,
70 compute_node_options
<Node
, ilist_parent
<void>>::type
>,
71 "default parent is void");
73 !std::is_same_v
<compute_node_options
<Node
, ilist_parent
<ParentA
>>::type
,
74 compute_node_options
<Node
, ilist_parent
<void>>::type
>,
75 "ParentA is not void");
77 !std::is_same_v
<compute_node_options
<Node
, ilist_parent
<ParentA
>>::type
,
78 compute_node_options
<Node
, ilist_parent
<ParentB
>>::type
>,
79 "ParentA is not ParentB");