| 69 | } |
| 70 | |
| 71 | void testConstructors() { |
| 72 | |
| 73 | // ----- Constructors ----- // |
| 74 | |
| 75 | Array<int> array1(mAllocator); |
| 76 | rp3d_test(array1.capacity() == 0); |
| 77 | rp3d_test(array1.size() == 0); |
| 78 | |
| 79 | Array<int> array2(mAllocator, 100); |
| 80 | rp3d_test(array2.size() == 0); |
| 81 | |
| 82 | Array<int> array3(mAllocator); |
| 83 | array3.add(1); |
| 84 | array3.add(2); |
| 85 | array3.add(3); |
| 86 | rp3d_test(array3.size() == 3); |
| 87 | |
| 88 | // ----- Copy Constructors ----- // |
| 89 | |
| 90 | Array<int> array4(array1); |
| 91 | rp3d_test(array4.capacity() == 0); |
| 92 | rp3d_test(array4.size() == 0); |
| 93 | |
| 94 | Array<int> array5(array3); |
| 95 | rp3d_test(array5.capacity() == array3.capacity()); |
| 96 | rp3d_test(array5.size() == array3.size()); |
| 97 | for (uint32 i=0; i<array3.size(); i++) { |
| 98 | rp3d_test(array5[i] == array3[i]); |
| 99 | } |
| 100 | |
| 101 | // ----- Test capacity grow ----- // |
| 102 | Array<std::string> arra6(mAllocator, 20); |
| 103 | for (uint32 i=0; i<20; i++) { |
| 104 | arra6.add("test"); |
| 105 | } |
| 106 | arra6.add("test"); |
| 107 | } |
| 108 | |
| 109 | void testAddRemoveClear() { |
| 110 | |