Skip to content

Commit fbfbb2c

Browse files
committed
Fix TPile Unittest
1 parent a36baee commit fbfbb2c

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed
Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
#if 0
2-
31
#include "TKernel/TPile.h"
42
#include <catch2/catch_test_macros.hpp>
53

64
TOSHI_NAMESPACE_USING
75

8-
static TPile m_soMemoryPile = TPile(0x1000, 0x3000, 0);
6+
static TPile s_oMemoryPile = TPile(0x2000, 0x1000, 0);
97

108
class PileTest
119
{
1210
public:
1311

14-
void* operator new(size_t size)
12+
void* operator new(unsigned int size)
1513
{
16-
return m_soMemoryPile.RawAlloc(size, 4);
14+
return s_oMemoryPile.RawAlloc(size, 4);
15+
}
16+
17+
void operator delete(void *ptr)
18+
{
19+
1720
}
1821

1922
int x[2000] = {2};
@@ -27,12 +30,11 @@ TEST_CASE("Test Pile Allocations", "[TPile]")
2730

2831
REQUIRE(pTest->x[0] == 2);
2932
REQUIRE(pTest->x[1] == 0);
33+
REQUIRE(pTest->x[1100] == 0);
3034
REQUIRE(pTest->y == 1);
31-
REQUIRE(m_soMemoryPile.RawIsInside(pTest));
32-
REQUIRE(!m_soMemoryPile.RawIsInside(pTest2));
35+
REQUIRE(s_oMemoryPile.RawIsInside(pTest));
36+
REQUIRE(!s_oMemoryPile.RawIsInside(pTest2));
3337

3438
delete pTest;
3539
delete pTest2;
36-
}
37-
38-
#endif
40+
}

0 commit comments

Comments
 (0)