There's no need to be so picky about the particular register.
[llvm/stm8.git] / unittests / ADT / ilistTest.cpp
blob09a699a9624640983b36e6fe82c632eccc2cec6f
1 //===- llvm/unittest/ADT/APInt.cpp - APInt unit tests ---------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
10 #include <ostream>
11 #include "gtest/gtest.h"
12 #include "llvm/ADT/ilist.h"
13 #include "llvm/ADT/ilist_node.h"
15 using namespace llvm;
17 namespace {
19 struct Node : ilist_node<Node> {
20 int Value;
22 Node() {}
23 Node(int _Value) : Value(_Value) {}
26 TEST(ilistTest, Basic) {
27 ilist<Node> List;
28 List.push_back(Node(1));
29 EXPECT_EQ(1, List.back().Value);
30 EXPECT_EQ(0, List.back().getPrevNode());
31 EXPECT_EQ(0, List.back().getNextNode());
33 List.push_back(Node(2));
34 EXPECT_EQ(2, List.back().Value);
35 EXPECT_EQ(2, List.front().getNextNode()->Value);
36 EXPECT_EQ(1, List.back().getPrevNode()->Value);
38 const ilist<Node> &ConstList = List;
39 EXPECT_EQ(2, ConstList.back().Value);
40 EXPECT_EQ(2, ConstList.front().getNextNode()->Value);
41 EXPECT_EQ(1, ConstList.back().getPrevNode()->Value);