Skip to content
Snippets Groups Projects
MemoryTest.cpp 707 B
Newer Older
#include "MemoryTest.h"
#include <compare>
#include <memory>

CPPUNIT_TEST_SUITE_NAMED_REGISTRATION ( MemoryTest, "bits" );
CPPUNIT_TEST_SUITE_REGISTRATION ( MemoryTest );

void MemoryTest::setUp ( ) {
}

void MemoryTest::tearDown ( ) {
}

void MemoryTest::comparePtrs ( ) {
	std::shared_ptr < int > i = std::make_shared < int > ( 1 );
	std::shared_ptr < int > j = i;
	std::shared_ptr < int > k = std::make_shared < int > ( 1 );
	std::shared_ptr < int > l;

	ext::compare < std::shared_ptr < int > > comp;

	CPPUNIT_ASSERT ( comp ( i, i ) == 0 );
	CPPUNIT_ASSERT ( comp ( i, j ) == 0 );
	CPPUNIT_ASSERT ( comp ( i, k ) == 0 );
	CPPUNIT_ASSERT ( comp ( i, l ) > 0 );
	CPPUNIT_ASSERT ( comp ( l, i ) < 0 );
}