1 //===- RTLinearAllocatorTest.h --------------------------------------------===//
2 //
3 //                     The MCLinker Project
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef RTLINEARALLOCATOR_TEST_H
10 #define RTLINEARALLOCATOR_TEST_H
11 
12 #include <gtest.h>
13 #include "mcld/Support/Allocators.h"
14 
15 namespace mcldtest {
16 
17 /** \class RTLinearAllocatorTest
18  *  \brief
19  *
20  *  \see RTLinearAllocator
21  */
22 class RTLinearAllocatorTest : public ::testing::Test {
23  public:
24   // Constructor can do set-up work for all test here.
25   RTLinearAllocatorTest();
26 
27   // Destructor can do clean-up work that doesn't throw exceptions here.
28   virtual ~RTLinearAllocatorTest();
29 
30   // SetUp() will be called immediately before each test.
31   virtual void SetUp();
32 
33   // TearDown() will be called immediately after each test.
34   virtual void TearDown();
35 
36  public:
37   struct Data {
DataData38     Data() : one(1), two(2), three(3), four(4) {}
39 
DataData40     Data(unsigned int pOne,
41          unsigned int pTwo,
42          unsigned char pThree,
43          unsigned char pFour) {
44       one = pOne;
45       two = pTwo;
46       three = pThree;
47       four = pFour;
48     }
49 
~DataData50     ~Data() {
51       one = -1;
52       two = -2;
53       three = -3;
54       four = -4;
55     }
56 
57     unsigned int one;
58     unsigned int two;
59     unsigned char three;
60     unsigned char four;
61   };
62   enum { CHUNK_SIZE = 32 };
63 
64  protected:
65   mcld::LinearAllocator<Data, 0>* m_pTestee;
66 };
67 
68 }  // namespace of mcldtest
69 
70 #endif
71