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 18 /** \class RTLinearAllocatorTest 19 * \brief 20 * 21 * \see RTLinearAllocator 22 */ 23 class RTLinearAllocatorTest : public ::testing::Test 24 { 25 public: 26 // Constructor can do set-up work for all test here. 27 RTLinearAllocatorTest(); 28 29 // Destructor can do clean-up work that doesn't throw exceptions here. 30 virtual ~RTLinearAllocatorTest(); 31 32 // SetUp() will be called immediately before each test. 33 virtual void SetUp(); 34 35 // TearDown() will be called immediately after each test. 36 virtual void TearDown(); 37 38 public: 39 struct Data { 40 Data() 41 : one(1), two(2), three(3), four(4) 42 { } 43 44 Data( unsigned int pOne, unsigned int pTwo, unsigned char pThree, unsigned char pFour) 45 { 46 one = pOne; 47 two = pTwo; 48 three = pThree; 49 four = pFour; 50 } 51 52 ~Data() 53 { 54 one = -1; 55 two = -2; 56 three = -3; 57 four = -4; 58 } 59 60 unsigned int one; 61 unsigned int two; 62 unsigned char three; 63 unsigned char four; 64 }; 65 enum { CHUNK_SIZE = 32 }; 66 67 protected: 68 mcld::LinearAllocator<Data,0>* m_pTestee; 69 }; 70 71 } // namespace of mcldtest 72 73 #endif 74 75