[llvm-objdump] - Cleanup the error reporting.
[llvm-complete.git] / unittests / ADT / IListNodeTest.cpp
blobcf775eb5d0699fabe2dc134b1e87227702ada07d
1 //===- unittests/ADT/IListNodeTest.cpp - ilist_node unit tests ------------===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/ADT/ilist_node.h"
10 #include "gtest/gtest.h"
11 #include <type_traits>
13 using namespace llvm;
14 using namespace llvm::ilist_detail;
16 namespace {
18 struct Node;
20 struct TagA {};
21 struct TagB {};
23 TEST(IListNodeTest, Options) {
24 static_assert(
25 std::is_same<compute_node_options<Node>::type,
26 compute_node_options<Node, ilist_tag<void>>::type>::value,
27 "default tag is void");
28 static_assert(
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");
32 static_assert(
33 !std::is_same<compute_node_options<Node, ilist_tag<TagA>>::type,
34 compute_node_options<Node, ilist_tag<TagB>>::type>::value,
35 "TagA is not TagB");
36 static_assert(
37 std::is_same<
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");
42 static_assert(
43 std::is_same<
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");
48 static_assert(
49 std::is_same<
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");
54 static_assert(
55 std::is_same<
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");
60 static_assert(
61 std::is_same<
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");
69 } // end namespace