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_v
<compute_node_options
<Node
>::type
,
26 compute_node_options
<Node
, ilist_tag
<void>>::type
>,
27 "default tag is void");
29 !std::is_same_v
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
30 compute_node_options
<Node
, ilist_tag
<void>>::type
>,
31 "default tag is void, different from TagA");
33 !std::is_same_v
<compute_node_options
<Node
, ilist_tag
<TagA
>>::type
,
34 compute_node_options
<Node
, ilist_tag
<TagB
>>::type
>,
38 compute_node_options
<Node
, ilist_sentinel_tracking
<false>>::type
,
39 compute_node_options
<Node
, ilist_sentinel_tracking
<false>,
40 ilist_tag
<void>>::type
>,
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
>,
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
>,
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
>,
59 "order shouldn't matter");
61 std::is_same_v
<compute_node_options
<Node
, ilist_sentinel_tracking
<true>,
62 ilist_tag
<TagA
>>::type
,
63 compute_node_options
<Node
, ilist_tag
<TagA
>,
64 ilist_sentinel_tracking
<true>>::type
>,
65 "order shouldn't matter with real tags");