Skip to content

Commit

Permalink
Added tests for the operator delete with sizeof as additional parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
basvodde committed May 25, 2016
1 parent 54d8bee commit 7ed0139
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/MemoryOperatorOverloadTest.cpp
Expand Up @@ -38,6 +38,15 @@ TEST(BasicBehavior, deleteInvalidatesMemory)
CHECK(*memory != 0xAD);
}

TEST(BasicBehavior, DeleteWithSizeParameterWorks)
{
char* charMemory = new char;
char* charArrayMemory = new char[10];
::operator delete(charMemory, sizeof(char));
::operator delete[](charArrayMemory, sizeof(char)* 10);
}


static void deleteUnallocatedMemory()
{
delete (char*) 0x1234678;
Expand Down

0 comments on commit 7ed0139

Please sign in to comment.