示例#1
0
int main( void )
{
	printf( "RSA Public Key Encryption Group Project v0.78\n" );
	printf( "COP 3503 - Team 1\n" );
	printf( "Programmer: Chris Pergrossi\n\n" );
	
	printf( "Running Diagnostic Self-Tests.\n" );

	///////////////////////////////////////////////////////////////////////////////////
	//
	// in order to use the incomplete library, we demonstrate indiviual function effect
	// and correctness of execution using our Testing Framework

	testGroup( TestGroup_PrimeNumber );
	testGroup( TestGroup_Base64 );

	///////////////////////////////////////////////////////////////////////////////////

	printf("Tests Complete.\n\n");
	printf("More Info: File Listing\n");
        printf("\tmain.cpp - contains the program entry point\n");
	printf("\tnint.cpp - contains a n-precision large int class that we were\n");
	printf("\t\tnot able to debug completely in time\n");
	printf("\tmessage.cpp - contains the class outline of an object designed\n");
	printf("\t\tto encapsulate message encryption and decryption\n");
	printf("\trsakeypair.cpp - contains classes to handle the storage and retrieval\n");
	printf("\t\tof RSA Keys through ASCII 'armor' and a fixed width format.\n");
	printf("\tprimenumber.cpp - contains an implemention of several Number Theory functions\n");
	printf("\t\tsuch as Euclid's Algorithm, a GCDfinder, prime generator, etc.\n");
	printf("\ttests.cpp - the implementation of our custom testing framework built\n");
	printf("\t\tto run reliable, repeatable tests on the ENTIRE application, on demand.\n");
	printf("\t\tAll the tests are fully modifiable and self-documented.\n");

	return 0;
}
tcu::TestCaseGroup* createEarlyFragmentTests (tcu::TestContext& testCtx)
{
	de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "early_fragment", "early fragment test cases"));

	static const struct
	{
		std::string caseName;
		deUint32	flags;
	} cases[] =
	{
		{ "no_early_fragment_tests_depth",					FLAG_TEST_DEPTH   | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS									},
		{ "no_early_fragment_tests_stencil",				FLAG_TEST_STENCIL | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS									},
		{ "early_fragment_tests_depth",						FLAG_TEST_DEPTH																			},
		{ "early_fragment_tests_stencil",					FLAG_TEST_STENCIL																		},
		{ "no_early_fragment_tests_depth_no_attachment",	FLAG_TEST_DEPTH   | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS | FLAG_DONT_USE_TEST_ATTACHMENT	},
		{ "no_early_fragment_tests_stencil_no_attachment",	FLAG_TEST_STENCIL | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS | FLAG_DONT_USE_TEST_ATTACHMENT	},
		{ "early_fragment_tests_depth_no_attachment",		FLAG_TEST_DEPTH   |										 FLAG_DONT_USE_TEST_ATTACHMENT  },
		{ "early_fragment_tests_stencil_no_attachment",		FLAG_TEST_STENCIL |										 FLAG_DONT_USE_TEST_ATTACHMENT	},
	};

	for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i)
		testGroup->addChild(new EarlyFragmentTest(testCtx, cases[i].caseName, cases[i].flags));

	return testGroup.release();
}
tcu::TestCaseGroup* createSparseResourcesShaderIntrinsicsTests (tcu::TestContext& testCtx)
{
	de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "shader_intrinsics", "Sparse Resources Shader Intrinsics"));

	static const deUint32 sizeCountPerImageType = 4u;

	struct ImageParameters
	{
		ImageType	imageType;
		tcu::UVec3	imageSizes[sizeCountPerImageType];
	};

	static const ImageParameters imageParametersArray[] =
	{
		{ IMAGE_TYPE_2D,		{ tcu::UVec3(512u, 256u, 1u),	tcu::UVec3(128u, 128u, 1u), tcu::UVec3(503u, 137u, 1u), tcu::UVec3(11u, 37u, 1u) } },
		{ IMAGE_TYPE_2D_ARRAY,	{ tcu::UVec3(512u, 256u, 6u),	tcu::UVec3(128u, 128u, 8u),	tcu::UVec3(503u, 137u, 3u),	tcu::UVec3(11u, 37u, 3u) } },
		{ IMAGE_TYPE_CUBE,		{ tcu::UVec3(256u, 256u, 1u),	tcu::UVec3(128u, 128u, 1u),	tcu::UVec3(137u, 137u, 1u),	tcu::UVec3(11u, 11u, 1u) } },
		{ IMAGE_TYPE_CUBE_ARRAY,{ tcu::UVec3(256u, 256u, 6u),	tcu::UVec3(128u, 128u, 8u),	tcu::UVec3(137u, 137u, 3u),	tcu::UVec3(11u, 11u, 3u) } },
		{ IMAGE_TYPE_3D,		{ tcu::UVec3(256u, 256u, 16u),	tcu::UVec3(128u, 128u, 8u),	tcu::UVec3(503u, 137u, 3u),	tcu::UVec3(11u, 37u, 3u) } }
	};

	static const tcu::TextureFormat formats[] =
	{
		tcu::TextureFormat(tcu::TextureFormat::R,	 tcu::TextureFormat::SIGNED_INT32),
		tcu::TextureFormat(tcu::TextureFormat::R,	 tcu::TextureFormat::SIGNED_INT16),
		tcu::TextureFormat(tcu::TextureFormat::R,	 tcu::TextureFormat::SIGNED_INT8),
		tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNSIGNED_INT32),
		tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNSIGNED_INT16),
		tcu::TextureFormat(tcu::TextureFormat::RGBA, tcu::TextureFormat::UNSIGNED_INT8)
	};

	static const std::string functions[SPARSE_SPIRV_FUNCTION_TYPE_LAST] =
	{
		"_sparse_fetch",
		"_sparse_read",
		"_sparse_sample_explicit_lod",
		"_sparse_sample_implicit_lod",
		"_sparse_gather",
	};

	for (deUint32 functionNdx = 0; functionNdx < SPARSE_SPIRV_FUNCTION_TYPE_LAST; ++functionNdx)
	{
		const SpirVFunction function = static_cast<SpirVFunction>(functionNdx);

		for (deInt32 imageTypeNdx = 0; imageTypeNdx < DE_LENGTH_OF_ARRAY(imageParametersArray); ++imageTypeNdx)
		{
			const ImageType					imageType = imageParametersArray[imageTypeNdx].imageType;
			de::MovePtr<tcu::TestCaseGroup> imageTypeGroup(new tcu::TestCaseGroup(testCtx, (getImageTypeName(imageType) + functions[functionNdx]).c_str(), ""));

			for (deInt32 formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(formats); ++formatNdx)
			{
				const tcu::TextureFormat&		format = formats[formatNdx];
				de::MovePtr<tcu::TestCaseGroup> formatGroup(new tcu::TestCaseGroup(testCtx, getShaderImageFormatQualifier(format).c_str(), ""));

				for (deInt32 imageSizeNdx = 0; imageSizeNdx < DE_LENGTH_OF_ARRAY(imageParametersArray[imageTypeNdx].imageSizes); ++imageSizeNdx)
				{
					const tcu::UVec3 imageSize = imageParametersArray[imageTypeNdx].imageSizes[imageSizeNdx];

					std::ostringstream stream;
					stream << imageSize.x() << "_" << imageSize.y() << "_" << imageSize.z();

					switch (function)
					{
					case SPARSE_FETCH:
						if ((imageType == IMAGE_TYPE_CUBE) || (imageType == IMAGE_TYPE_CUBE_ARRAY)) continue;
					case SPARSE_SAMPLE_EXPLICIT_LOD:
					case SPARSE_SAMPLE_IMPLICIT_LOD:
					case SPARSE_GATHER:
						if ((imageType == IMAGE_TYPE_CUBE) || (imageType == IMAGE_TYPE_CUBE_ARRAY) || (imageType == IMAGE_TYPE_3D)) continue;
						break;
					default:
						break;
					}

					switch (function)
					{
					case SPARSE_FETCH:
						formatGroup->addChild(new SparseCaseOpImageSparseFetch(testCtx, stream.str(), function, imageType, imageSize, format));
						break;
					case SPARSE_READ:
						formatGroup->addChild(new SparseCaseOpImageSparseRead(testCtx, stream.str(), function, imageType, imageSize, format));
						break;
					case SPARSE_SAMPLE_EXPLICIT_LOD:
						formatGroup->addChild(new SparseCaseOpImageSparseSampleExplicitLod(testCtx, stream.str(), function, imageType, imageSize, format));
						break;
					case SPARSE_SAMPLE_IMPLICIT_LOD:
						formatGroup->addChild(new SparseCaseOpImageSparseSampleImplicitLod(testCtx, stream.str(), function, imageType, imageSize, format));
						break;
					case SPARSE_GATHER:
						formatGroup->addChild(new SparseCaseOpImageSparseGather(testCtx, stream.str(), function, imageType, imageSize, format));
						break;
					default:
						DE_ASSERT(0);
						break;
					}
				}
				imageTypeGroup->addChild(formatGroup.release());
			}
			testGroup->addChild(imageTypeGroup.release());
		}
	}

	return testGroup.release();
}