sourcehook/test/testhookmangen.cpp
branchhookman_autogen
changeset 478 f2317a2cb421
parent 469 0e951d1cd286
     1.1 --- a/sourcehook/test/testhookmangen.cpp	Sun Nov 25 00:12:56 2007 +0000
     1.2 +++ b/sourcehook/test/testhookmangen.cpp	Sun Nov 25 01:20:00 2007 +0000
     1.3 @@ -1200,5 +1200,30 @@
     1.4  
     1.5  	memset((void*)test4[2], 0, ps / 4);
     1.6  
     1.7 +	// alignement tests
     1.8 +	CPageAlloc alloc1(1);
     1.9 +	CPageAlloc alloc4(4);
    1.10 +	CPageAlloc alloc16(16);
    1.11 +
    1.12 +	void *last1 = alloc1.Alloc(1);
    1.13 +	void *last4 = alloc4.Alloc(4);
    1.14 +	void *last16 = alloc16.Alloc(16);
    1.15 +	void *cur;
    1.16 +	for (int i = 0; i < 20; ++i)
    1.17 +	{
    1.18 +		cur = alloc1.Alloc(1);
    1.19 +		CHECK_COND(reinterpret_cast<intptr_t>(cur) == reinterpret_cast<intptr_t>(last1) + 1, "Part 4.1");
    1.20 +		last1 = cur;
    1.21 +
    1.22 +		cur = alloc4.Alloc(1);
    1.23 +		CHECK_COND(reinterpret_cast<intptr_t>(cur) == reinterpret_cast<intptr_t>(last4) + 4, "Part 4.2");
    1.24 +		last4 = cur;
    1.25 +
    1.26 +		cur = alloc16.Alloc(1);
    1.27 +		CHECK_COND(reinterpret_cast<intptr_t>(cur) == reinterpret_cast<intptr_t>(last16) + 16, "Part 4.3");
    1.28 +		last16 = cur;
    1.29 +	}
    1.30 +
    1.31 +	alloc16.Free(alloc16.Alloc(1));
    1.32  	return true;
    1.33  }