void TestImageModifierStack(void)
{
	BeginTests();

	CImage					cImage;
	CImageModifierStack		cStack;
	BOOL					bResult;
	CImageRGBToGrey*		pcGrey;
	CImageHeightToNormals*	pcNormals;
	CImageResampler*		pcSmall;
	CImage					cBak;

	bResult = ReadImage(&cBak, "Input/Adelle.png");
	AssertBool(TRUE, bResult);

	cImage.Copy(&cBak);
	cStack.Init(&cImage);

	pcGrey = cStack.AddModifier<CImageRGBToGrey>();
	pcGrey->Init(RGBTGS_UseRed);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleGrey.raw");
	AssertFileMemory("Input/AdelleGrey.raw", cImage.GetData(), cImage.GetByteSize());
	cImage.Kill();

	pcNormals = cStack.AddModifier<CImageHeightToNormals>();
	pcNormals->Init(IMAGE_DIFFUSE_GREY);
	cImage.Copy(&cBak);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleNormal.raw");
	AssertFileMemory("Input/AdelleNormal.raw", cImage.GetData(), cImage.GetByteSize());
	cImage.Kill();

	pcSmall = cStack.AddModifier<CImageResampler>();
	pcSmall->Init(IR_NearestNeighbour, 21, 16);
	cImage.Copy(&cBak);
	cStack.ApplyAll();

	WriteImage(&cImage, "Output/AdelleSmall.raw");
	AssertFileMemory("Input/AdelleSmall.raw", cImage.GetData(), cImage.GetByteSize());
	AssertInt(3, cStack.NumModifiers());

	cStack.Kill();
	cImage.Kill();

	cBak.Kill();

	TestStatistics();
}
void TestMemoryCache(void)
{
	BeginTests();
	FastFunctionsInit();

	TestMemoryCacheSimple();
	TestMemoryCacheBrokenExample();
	TestMemoryCacheEvictAll();
	TestMemoryCacheEvictLeftmost();
	TestMemoryCacheEvictRightmost();

	FastFunctionsKill();
	TestStatistics();
}
Пример #3
0
void TestFileSystem(void)
{
	BeginTests();
	FastFunctionsInit();

	TestFileSystemInit();
	TestFileSystemNearest();
	TestFileSystemFindExtension();
	TestFileSystemGetFiles();
	TestFileSystemIterator();

	FastFunctionsKill();
	TestStatistics();
}
void TestStringHelper(void)
{
	BeginTests();

	TestStrICmp();
	TestStrIStr();
	TestStrRev();
	TestMemICmp();
	TestIToA();
	TestToLower();
	TestToUpper();

	TestStatistics();
}
void TestChunkFile(void)
{
	BeginTests();
	FastFunctionsInit();
	MemoryInit();
	
	TestChunkFileSimple();
	TestChunkFileMD5ing();
	TestChunkFileNameing();

	MemoryKill();
	FastFunctionsKill();
	TestStatistics();
}
void TestArrayTemplateEmbedded(void)
{
	BeginTests();
	FastFunctionsInit();

	TestArrayTemplateEmbeddedAdd();
	TestArrayTemplateEmbeddedRemoveAt();
	TestArrayTemplateEmbeddedRemove();
	TestArrayTemplateEmbeddedSizeof();
	TestArrayTemplateEmbeddedAllocationWithVirtualClass();

	FastFunctionsKill();
	TestStatistics();
}
void TestObjectReaderSimple(void)
{
	CFileUtil	cFileUtil;

	cFileUtil.RemoveDir("Output");
	cFileUtil.MakeDir("Output/ObjectReaderSimple");
	BeginTests();

	TestObjectReaderSimpleDeserialised();

	TestStatistics();

	cFileUtil.RemoveDir("Output");
}
Пример #8
0
void TestPackFilesPacker(void)
{
	BeginTests();

	FastFunctionsInit();
	MemoryInit();

	TestPackFilesPackerSimple();
	TestPackFilesPackerCopyDir();

	MemoryKill();
	FastFunctionsKill();

	TestStatistics();
}
void TestObjectWriterChunked(void)
{
	CFileUtil	cFileUtil;

	cFileUtil.RemoveDir("Output");
	cFileUtil.MakeDir("Output/ObjectWriterChunked");
	BeginTests();

	TestObjectWriterChunkedWrite();
	TestObjectWriterChunkedSerialised();

	TestStatistics();

	cFileUtil.RemoveDir("Output");
}
void TestObjectGraphDeserialiser(void)
{
	CFileUtil	cFileUtil;

	cFileUtil.RemoveDir("Output");

	BeginTests();

	TestRemappingOfSimpleFilesOIs();
	TestRemappingOfChunkedFilesOIs();
	TestOverwritingOfExistingNamesFromChunkedFiles();

	TestStatistics();

	cFileUtil.RemoveDir("Output");
}
void TestObjectReaderChunked(void)
{
	CFileUtil	cFileUtil;

	cFileUtil.RemoveDir("Output");
	cFileUtil.MakeDir("Output/ObjectReaderChunked");
	ObjectsInit();
	BeginTests();

	TestObjectReaderChunkedDeserialised();

	TestStatistics();
	ObjectsKill();

	cFileUtil.RemoveDir("Output");
}
Пример #12
0
void TestMapBlock(void)
{
	BeginTests();
	MemoryInit();
	FastFunctionsInit();

	TestMapBlockInternals();
	TestMapBlockGet();
	TestMapBlockAddDuplicate();
	TestMapBlockRemove();
	TestMapBlockReadWrite();

	FastFunctionsKill();
	MemoryKill();
	TestStatistics();
}
Пример #13
0
void TestEmbedded(void)
{
	BeginTests();

	TestEmbeddedFlags();
	TestEmbeddedOjectIsAllocatedInObjects();
	TestEmbeddedObjectAddDistToRoot();
	TestEmbeddedObjectRemoveDistToRoot();
	TestEmbeddedObjectKill();
	TestEmbeddedObjectContainerDehollowfication();
	TestEmbeddedGetEmbeddedIndex();
	TestEmbeddedObjectClass();
	TestEmbeddedGetEmbeddedObject();
	TestEmbeddedObjectPointTo();

	TestStatistics();
}
Пример #14
0
void TestArrayTemplate(void)
{
	BeginTests();
	MemoryInit();
	FastFunctionsInit();

	TestMisc();
	TestArrayAllocation();
	TestArrayCopy();
	TestArraySorting();
	TestArrayRemove();
	TestArrayFake();

	FastFunctionsKill();
	MemoryKill();
	TestStatistics();
}
Пример #15
0
void TestNumbers(void)
{
	BeginTests();

	float	fTiny;

	fTiny = SMALL_NUMBER/2.0f;

	AssertTrue(FloatEqual(10, 10));
	AssertFalse(FloatEqual(10, 11));
	AssertFalse(FloatEqual(11, 10));

	AssertTrue(FloatEqual(10, 10-fTiny));
	AssertTrue(FloatEqual(10, 10+fTiny));
	AssertTrue(FloatEqual(10-fTiny, 10));
	AssertTrue(FloatEqual(10+fTiny, 10));

	AssertTrue(FloatGreaterThanOrEqual(10, 10));
	AssertTrue(FloatGreaterThanOrEqual(11, 10));
	AssertFalse(FloatGreaterThanOrEqual(10, 11));
	AssertTrue(FloatGreaterThanOrEqual(10-fTiny, 10));
	AssertTrue(FloatGreaterThanOrEqual(10, 10+fTiny));

	AssertTrue(FloatLessThanOrEqual(10, 10));
	AssertTrue(FloatLessThanOrEqual(10, 11));
	AssertFalse(FloatLessThanOrEqual(11, 10));
	AssertTrue(FloatLessThanOrEqual(10+fTiny, 10));
	AssertTrue(FloatLessThanOrEqual(10, 10-fTiny));

	AssertFalse(FloatGreaterThan(10, 10));
	AssertFalse(FloatGreaterThan(10, 11));
	AssertTrue(FloatGreaterThan(11, 10));
	AssertFalse(FloatGreaterThan(10+fTiny, 10));
	AssertFalse(FloatGreaterThan(10, 10-fTiny));

	AssertFalse(FloatLessThan(10, 10));
	AssertFalse(FloatLessThan(11, 10));
	AssertTrue(FloatLessThan(10, 11));
	AssertFalse(FloatLessThan(10-fTiny, 10));
	AssertFalse(FloatLessThan(10, 10+fTiny));

	TestStatistics();
}
Пример #16
0
void TestObjects(void)
{
	BeginTests();

	TestObjectsObjectKillInGraph();
	TestObjectsArrayKillInGraph();
	TestObjectsObjectKillInArrayInGraph();
	TestObjectsInMemoryIteration();
	TestObjectsObjectSave();
	TestObjectsFlushRemovesStackPointers();
	TestObjectsFlushNoClear();
	TestObjectsFlushClearGetByOid();
	TestObjectsFlushClearGetByName();
	TestObjectsFlushDurable();
	TestObjectsEvict();
	TestObjectDehollowfication();

	TestStatistics();
}
Пример #17
0
void TestImageSwizzle(void)
{
	BeginTests();

	CImage					cImage;
	CImageModifierStack		cStack;
	CImageRGBToGrey*		pcRGBToGrey;
	CImageChannelRename*	pcChannelRename;
	CImageChannelAdd*		pcChannelAdd;
	CImageDrawBox*			pcDrawBox;
	CImageColourRGB			cRGB;

	ReadImage(&cImage, "Input\\swizzel.png");

	cStack.Init(&cImage);
	
	pcRGBToGrey = cStack.AddModifier<CImageRGBToGrey>();
	pcRGBToGrey->Init(RGBTGS_OnlyIfChannelsSame);

	pcChannelRename = cStack.AddModifier<CImageChannelRename>();
	pcChannelRename->Init(IMAGE_DIFFUSE_GREY, IMAGE_OPACITY);

	pcChannelAdd = cStack.AddModifier<CImageChannelAdd>();
	pcChannelAdd->Init(IMAGE_DIFFUSE_RED, PT_uchar);
	pcChannelAdd->AddChannel(IMAGE_DIFFUSE_GREEN);
	pcChannelAdd->AddChannel(IMAGE_DIFFUSE_BLUE);

	pcDrawBox = cStack.AddModifier<CImageDrawBox>();
	
	cRGB.Init(1.0f, 1.0f, 1.0f);
	pcDrawBox->Init(NULL, &cRGB);

	cStack.ApplyAll();
	cStack.Kill();

	WriteImage(&cImage, "Output\\swizzle.raw");
	AssertFileMemory("input\\swizzle.raw", cImage.GetData(), cImage.GetByteSize());

	cImage.Kill();

	TestStatistics();
}
Пример #18
0
void TestFiles(void)
{
	BeginTests();
	
	FastFunctionsInit();
	TypeConverterInit();
	MemoryInit();

	TestFilesSimple();
	TestFileSystemIteration();
	TestFilesIteration();
	TestGetFileNames();
	TestFilesWholeDirectory();

	MemoryKill();
	FastFunctionsKill();
	TypeConverterKill();

	TestStatistics();
}
Пример #19
0
void TestFileUtil(void)
{
	BeginTests();
	MemoryInit();
	FastFunctionsInit();

	TestFileUtilRemoveExtension();
	TestFileUtilFindExtension();
	TestFileUtilNaming();
	TestFileUtilMisc();
	TestFileUtilMakeNameFromDirectory();
	TestFileUtilMakeDirectory();
	TestFileUtilRemoveLastFromPath();
	TestFileUtilTouchDirectory();
	TestFileUtilPrependToPath();

	FastFunctionsKill();
	MemoryKill();
	TestStatistics();
}
void TestArrayPrimitiveTemplate(void)
{
	CArrayChar		aChars;
	CArrayFloat		aFloats;
	CArrayDouble	aDoubles;
	CArrayLong		aLongs;
	int				iIndex;

	BeginTests();

	aChars.Init(1);
	aChars.Add('A');
	AssertChar('A', aChars.GetValue(0));
	aChars.Kill();

	aFloats.Init(2);
	aFloats.InsertAt(5.1f, 0);
	AssertFloat(5.1f, aFloats.GetValue(0), 2);
	AssertInt(2, aFloats.AllocatedElements());
	AssertInt(1, aFloats.NumElements());
	aFloats.Kill();

	aDoubles.Init(3);
	aDoubles.Add(0.0);
	aDoubles.Add(0.1);
	aDoubles.Add(0.2);
	aDoubles.Add(0.3);
	aDoubles.Add(0.4);
	AssertTrue(aDoubles.IsSorted());
	aDoubles.InsertAt(0.5, 2);
	AssertFalse(aDoubles.IsSorted());
	aDoubles.Kill();

	aLongs.Init(4);
	aLongs.AddList(0LL, 4LL, 0x3122345482773411LL, 2LL, 1LL, 0LL);
	iIndex = aLongs.Find(0x3122345482773411LL);
	AssertInt(1, iIndex);
	aLongs.Kill();

	TestStatistics();
}
void TestImageGreyToRGB(void)
{
	BeginTests();

	CImage				cImage;
	CImageGreyToRGB		cGreyToRGB;

	ReadImage(&cImage, "Input/basn0g08.png");

	cGreyToRGB.Init();
	cGreyToRGB.Modify(&cImage);
	cGreyToRGB.Kill();

	WriteImage(&cImage, "Output/GreyToRGB.raw");
	AssertFileMemory("input/GreyToRGB.raw", cImage.GetData(), cImage.GetByteSize());

	cGreyToRGB.Kill();
	cImage.Kill();

	TestStatistics();
}
void TestChannelsAccessor(void)
{
	BeginTests();
	MemoryInit();
	TypesInit();
	TypeConverterInit();
	UnknownsInit();

	TestChannelsAccessorContiguous();
	TestChannelsAccessorByteAligned();
	TestChannelsAccessorTypeConvert();
	TestChannelsAccessorChannelBitty();
	TestChannelsAccessorAccessBitty();
	TestChannelsAccessorWorstCase();

	UnknownsKill();
	TypeConverterKill();
	TypesKill();
	MemoryKill();
	TestStatistics();
}
Пример #23
0
void TestLogFile(void)
{
	BeginTests();

	FastFunctionsInit();
	TypeConverterInit();

	TestLogFileOpen();
	TestLogFileRead();
	TestLogFileWrite();
	TestLogFileFindHoles();
	TestLogFileCommandsSimple();
	TestLogFileCommandsComplex();
	TestLogFileDelete();
	TestLogFileMultipleReadsAfterOpens();

	FastFunctionsKill();
	TypeConverterKill();

	TestStatistics();
}
Пример #24
0
void TestIndexTreeBlockMemory(void)
{
	BeginTests();
	FastFunctionsInit();
	MemoryInit();

	TestIndexTreeBlockMemoryKill();
	TestIndexTreeBlockMemoryAdd();
	TestIndexTreeBlockMemoryGet();
	TestIndexTreeBlockMemoryPutDuplicate();
	TestIndexTreeBlockMemoryValidateInternalConsistency();
	TestIndexTreeBlockMemoryCountAllocatedNodes();
	TestIndexTreeBlockMemoryRemoveResize();
	TestIndexTreeBlockMemoryRemoveByObject();
	TestIndexTreeBlockMemoryHasKey();
	TestIndexTreeBlockMemoryRemoveNullNode();
	TestIndexTreeBlockMemoryAddLongLong();
	TestIndexTreeBlockMemoryIterate();
	TestIndexTreeBlockMemoryReadWrite();

	MemoryKill();
	FastFunctionsKill();
	TestStatistics();
}