Ejemplo n.º 1
0
//////////
//
// #04 - Re-create everything as in test #01, then delete the entire chain
//
//////
	bool iivvmt_testSll4_4(u64 lnHandleLog, SLL4** root)
	{
		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL4_DELETE_CHAIN);


		//////////
		// Populate the root with our original 9-panel arrangement
		// Note:  If we are at this point it the test, we know it will pass
		//////
			iivvmt_testSll4_1(lnHandleLog, root);


		//////////
		// Clean house
		//////
			vvm_ll4_deleteChain(root, _LL4_ALL);
			if (*root)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 2
0
//////////
//
// Top level for running test cases against the BXML engine.
//
//////
bool ivvmt_testBxml(u64 lnHandleLog)
{
    SBxml* bxml;


    //////////
    // Indicate what test we're running
    //////
    vvm_resourcePrintf(IDS_VVM_TEST_BXML_TESTING);


    //////////
    // Note: These tests cascade, so that if one fails the ones after cannot continue
    //////
    if (!iivvmt_testBxml_1	(lnHandleLog, &bxml))	return false;			// #01 - Process the sample bxml file (in Bxml_test1.h as cgc_Test_Bxml_1_1)
    if (!iivvmt_testBxml_2	(lnHandleLog, bxml))	return false;			// #02 - Save the processed bxml file to disk (should match cgc_Test_Bxml_2_1 in Bxml_test2.h)
    if (!iivvmt_testBxml_3	(lnHandleLog, bxml))	return false;			// #03 - Create a bxml duplicate copy of our input.bxml, then delete it
    if (!iivvmt_testBxml_4	(lnHandleLog, bxml))	return false;			// #04 - Search for nodes, attributes, and data
    if (!iivvmt_testBxml_5	(lnHandleLog, bxml))	return false;			// #05 - Append sibling nodes (append and prepend)
    if (!iivvmt_testBxml_6	(lnHandleLog, bxml))	return false;			// #06 - Append child nodes (append and prepend)
    if (!iivvmt_testBxml_7	(lnHandleLog, bxml))	return false;			// #07 - Append attributes (append and prepend)
    if (!iivvmt_testBxml_8	(lnHandleLog, bxml))	return false;			// #08 - Move sibling nodes (delete, insert before, and insert after)
    if (!iivvmt_testBxml_9	(lnHandleLog, bxml))	return false;			// #09 - Move child nodes (delete, insert before, and insert after)
    if (!iivvmt_testBxml_10	(lnHandleLog, bxml))	return false;			// #10 - Move attributes (delete, insert before, and insert after)
    if (!iivvmt_testBxml_11	(lnHandleLog, bxml))	return false;			// #11 - Delete sibling nodes (first, middle, last)
    if (!iivvmt_testBxml_12	(lnHandleLog, bxml))	return false;			// #12 - Delete child nodes (first, middle, last)
    if (!iivvmt_testBxml_13	(lnHandleLog, bxml))	return false;			// #13 - Delete attributes (first, middle, last)


    //////////
    // When we get here, success
    /////
    vvm_resourcePrintf(IDS_VVM_TEST_BXML_PASSED);
    return true;
}
Ejemplo n.º 3
0
//////////
//
// Top level for running test cases against the Canvas engine.
//
//////
	bool ivvmt_testCanvas(u64 lnHandleLog)
	{
		// Indicate what test we're running
		vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_TESTING);

		// These tests cascade, if one fails the ones after cannot continue
		if (!iivvmt_testCanvas_1(lnHandleLog))			return false;							// #01 - Process gradient and large scaling
		if (!iivvmt_testCanvas_2(lnHandleLog))			return false;							// #01 - Process fine grained scaling

		// When we get here, success
		vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_PASSED);
		return true;
	}
Ejemplo n.º 4
0
//////////
// #13 - Delete attributes (first, middle, last)
//////
bool iivvmt_testBxml_13(u64 lnHandleLog, SBxml* bxml)
{
    // Tell which test we're running
    printf("\tDelete attributes...");

    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 5
0
//////////
//
// Top level for running test cases against the SHA-1 engine.
//
//////
	bool ivvmt_testSha1(u64 lnHandleLog)
	{
		// Indicate which test
		vvm_resourcePrintf(IDS_VVM_TEST_SHA1_TESTING);


		//////////
		//
		// #01 - FIPS PUB 180-1
		//
		//////
			if (!iivvmt_testSha1_1(lnHandleLog))
				return false;		// failure


		// When we get here, success
		vvm_resourcePrintf(IDS_VVM_TEST_SHA1_PASSED);
		return true;
	}
Ejemplo n.º 6
0
//////////
//
// Top level for running test cases against the SHA-1 engine.
//
//////
	bool ivvmt_testSll4(u64 lnHandleLog)
	{
		SLL4* root;


		// Indicate which test
		vvm_resourcePrintf(IDS_VVM_TEST_SLL4_TESTING);


		//////////
		// #01 - Create a nine element 4-way linked list, one in the middle, and two extending out in all four directions
		//////
			if (!iivvmt_testSll4_1(lnHandleLog, &root))
				return false;		// failure


		//////////
		// #02 - Append a chain
		//////
			if (!iivvmt_testSll4_2(lnHandleLog, root))
				return false;		// failure


		//////////
		// #03 - Delete everything in pieces and in chains
		//////
			if (!iivvmt_testSll4_3(lnHandleLog, &root))
				return false;		// failure


		//////////
		// #04 - Re-create everything as in test #01, then delete the entire chain
		//////
			if (!iivvmt_testSll4_4(lnHandleLog, &root))
				return false;		// failure


		// When we get here, success
		vvm_resourcePrintf(IDS_VVM_TEST_SLL4_PASSED);
		return true;
	}
Ejemplo n.º 7
0
//////////
// #01 - Process the sample bxml file (in Bxml_test1.h as cgc_Test_Bxml_1_1)
//////
bool iivvmt_testBxml_1(u64 lnHandleLog, SBxml** bxml)
{
    u64		lnErrorOffset, lnErrorCode, lnSha1As64Bit;
    u32		lnSha1As32Bit;
    u8		sha20Bytes[20];


    // Tell which test we're running
    vvm_resourcePrintf(IDS_VVM_TEST_BXML_1);

    // Make sure the SHA-1 value matches our expectation
    vvm_sha1ComputeSha1((s8*)cgc_Test_Bxml_1_1, sizeof(cgc_Test_Bxml_1_1), sha20Bytes);
    lnSha1As64Bit = vvm_sha1Compute64BitFromSha1(sha20Bytes);
    lnSha1As32Bit = vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgn_Test_Bxml_1_1Sha1As64Bit || lnSha1As32Bit != cgn_Test_Bxml_1_1Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_INVALID_FILE);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // Try to load bxml file
    lnErrorOffset	= 0;
    lnErrorCode		= 0;
    *bxml = vvm_bxmlLoadFromBuffer((s8*)cgc_Test_Bxml_1_1, sizeof(cgc_Test_Bxml_1_1) - 1, &lnErrorOffset, &lnErrorCode);
    if (*bxml && lnErrorOffset == 0 && lnErrorCode == 0)
    {
        // Grab the SHA-1 value from the converted file
        lnSha1As64Bit	= vvm_bxmlNodeSha1(*bxml, sha20Bytes);
        lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
        if (lnSha1As64Bit != cgnTestBxmlDotHNodeSha1As64Bit || lnSha1As32Bit != cgnTestBxmlDotHNodeSha1As32Bit)
        {
            // The file does not match the expected SHA-1 value
            vvm_resourcePrintf(IDS_VVM_TEST_BXML_INVALID_FILE);
            vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
            return(false);
        }
        // If we get here, we're good

    } else {
        // Failure
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_UNABLE_TO_LOAD);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 8
0
//////////
//
// Top level for running test cases against the SHA-1 engine.
//
//////
	bool ivvmt_testSll(u64 lnHandleLog)
	{
		SLL* root;


		// Indicate which test
		vvm_resourcePrintf(IDS_VVM_TEST_SLL_TESTING);


		//////////
		// #01 - Create a three element linked list
		//////
			if (!iivvmt_testSll_1(lnHandleLog, &root))
				return false;		// failure


		//////////
		// #02 - Append an item before and after the middle item, then before and after the beginning and ending items
		//////
			if (!iivvmt_testSll_2(lnHandleLog, root))
				return false;		// failure


		//////////
		// #03 - Delete first item, last item, middle item
		//////
			if (!iivvmt_testSll_3(lnHandleLog, &root))
				return false;		// failure


		//////////
		// Clean house
		//////
			vvm_ll_deleteChain(&root);


		// When we get here, success
		vvm_resourcePrintf(IDS_VVM_TEST_SLL_PASSED);
		return true;
	}
Ejemplo n.º 9
0
//////////
// #03 - Create a bxml duplicate copy of our input.bxml, then delete it
//////
// For debugging:
// vvm_bxmlSave(bxml,		"c:\\temp\\bxml.bxml",		18, true, true, &lnSha1As64Bit);
// vvm_bxmlSave(bxmlCopy,	"c:\\temp\\bxmlCopy.bxml",	18, true, true, &lnSha1As64Bit);
bool iivvmt_testBxml_3(u64 lnHandleLog, SBxml* bxml)
{
    u64		lnSha1As64Bit;
    u32		lnSha1As32Bit;
    bool	llResult;
    SBxml*	bxmlCopy;
    u8		sha20Bytes[20];


    // Tell which test we're running
    vvm_resourcePrintf(IDS_VVM_TEST_BXML_3);

    // Copy the node
    bxmlCopy = vvm_bxmlNodeCopy(bxml, true, true, &llResult);
    if (!bxmlCopy || !llResult)
    {
        // Unable to copy the node
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_COPY_FAILED);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // Make sure it copied correctly
    lnSha1As64Bit	= vvm_bxmlNodeSha1(bxmlCopy, sha20Bytes);
    lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxmlDotHNodeSha1As64Bit || lnSha1As32Bit != cgnTestBxmlDotHNodeSha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }
    // If we get here, we're good, the re-loaded file matched the form with which it was
    // saved, and the SHA-1 validation upon reload indicated they were identical.
    // In short, it's time to do a little dance! Woo hoo! :-)


    // Delete the duplicate node
    vvm_bxmlNodeDelete(bxmlCopy, true);
    bxmlCopy = NULL;

    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 10
0
	//////////
	// #02 - Create a canvas, load an image, validate SHA-1, scale it a couple times and validate SHA-1s
	//////
		bool iivvmt_testCanvas_2(u64 lnHandleLog)
		{
			s64			lnResult;
			u64			lnSha1As64Bit;
			u32			lnSha1As32Bit, lnWidth, lnHeight;
			u8			sha20Bytes[20];
			s8*			lcTemp;
			SCanvas*	canvas;
			SCanvas*	canvasScaled1;
			SCanvas*	canvasScaled2;


			// Tell which test we're running
			vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_1);


			//////////
			// Create the standard canvas
			//////
				lcTemp = oss_sharedAsciiGetTempFilename();
				if (!oss_sharedAsciiWriteOutFile(lcTemp, (s8*)&cgc_Test2_Canvas[0], sizeof(cgc_Test2_Canvas)))
				{
					// Failure writing out the temp file
// TODO: localization here
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_CANNOT_CREATE/*IDS_VVM_TEST_CANVAS_CANNOT_SAVE_TEST_BITMAP_TO_DISK*/);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}

				// Attempt to load it as a valid bitmap
				lnResult = (s64)oss_loadBitmapFromDisk(lcTemp, &canvas, &lnWidth, &lnHeight, rgba(0,0,0,255));

				// Delete the temp file
				oss_sharedAsciiDeleteFile(lcTemp);

				// Did the bitmap load okay?
				if (lnResult < 0 || !canvas)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}

				// For debugging:
				oss_saveBitmapToDisk(canvas, canvas->bd, "\\temp\\canvas2.bmp");


			//////////
			// Create a canvas for scaling
			//////
				canvasScaled1 = oss_requestCanvas(0, lnWidth - 1, lnHeight - 1, rgba(0,0,0,255), true, true);
				if (!canvasScaled1)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Create another canvas for scaling
			//////
				canvasScaled2 = oss_requestCanvas(0, lnWidth + 1, lnHeight + 1, rgba(0,0,0,255), true, true);
				if (!canvasScaled2)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvas->bd, canvas->width * canvas->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test2_Canvas_Sha1As64Bit || lnSha1As32Bit != cgn_Test2_Canvas_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Scale the gradient
			//////
				oss_canvasScale(canvasScaled1, canvas);
				// For debugging:
				oss_saveBitmapToDisk(canvasScaled1, canvasScaled1->bd, "\\temp\\canvas2Scaled1.bmp");


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvasScaled1->bd, canvasScaled1->width * canvasScaled1->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test2_CanvasScaled1_Sha1As64Bit || lnSha1As32Bit != cgn_Test2_CanvasScaled1_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Scale the gradient
			//////
				oss_canvasScale(canvasScaled2, canvas);
				// For debugging:
				oss_saveBitmapToDisk(canvasScaled2, canvasScaled2->bd, "\\temp\\canvas2Scaled2.bmp");


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvasScaled2->bd, canvasScaled2->width * canvasScaled2->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test2_CanvasScaled2_Sha1As64Bit || lnSha1As32Bit != cgn_Test2_CanvasScaled2_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			// If we get here, we're good
			vvm_resourcePrintf(IDS_VVM_TEST_PASS);
			return(true);
		}
Ejemplo n.º 11
0
//////////
// #08 - Move sibling nodes (delete, insert before, and insert after)
//////
bool iivvmt_testBxml_8(u64 lnHandleLog, SBxml* bxml)
{
    u64			lnSha1As64Bit;
    u32			lnSha1As32Bit;
    SBxml*		bxmlReference1;
    SBxml*		bxmlReference2;
    SDatum		wildcardSearch1;
    SDatum		wildcardSearch2;
    u8			sha20Bytes[_SHA1_NUMBER_SIZE];


    //////////
    // Tell which test we're running
    //////
    printf("\tMove sibling nodes...");


    //////////
    // Grab items for subsequent delete and insert
    //////
    // Grandchild1
    wildcardSearch1.data._cs8	= cgcTestBxml8FindChildNode1;
    wildcardSearch1.length		= sizeof(cgcTestBxml8FindChildNode1) - 1;
    vvm_bxmlFindFirst(bxml, &bxmlReference1, NULL, &wildcardSearch1, true, false, NULL);
    if (!bxmlReference1)
    {
        // Failure, node wasn't found
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // Grandchild2
    wildcardSearch2.data._cs8	= cgcTestBxml8FindChildNode2;
    wildcardSearch2.length		= sizeof(cgcTestBxml8FindChildNode2) - 1;
    vvm_bxmlFindFirst(bxml, &bxmlReference2, NULL, &wildcardSearch2, true, false, NULL);
    if (!bxmlReference1)
    {
        // Failure, node wasn't found
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Make grandchild2 an orphan
    //////
    vvm_bxmlNodeDelete(bxmlReference2, false);
    vvm_bxmlSave(bxml, "c:\\temp\\bxml_8delete.bxml", -1, true, true, NULL);


    //////////
    // Compute the SHA-1
    //////
    lnSha1As64Bit	= vvm_bxmlNodeSha1(bxml, sha20Bytes);
    lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml81_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml81_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Insert grandchild2 before grandchild1
    //////
// TODO:  Working here.  I think the insert child is not updating the prev links properly, such as on grandchild1->prev pointing back to prependNode6
    vvm_bxmlNodeInsert(bxmlReference2, bxmlReference1, false);
    vvm_bxmlSave(bxml, "c:\\temp\\bxml_8insertbefore.bxml", -1, true, true, NULL);
    // Note, at this point we leave them installed in the original bxml file, where they are


    //////////
    // Compute the SHA-1
    //////
    lnSha1As64Bit	= vvm_bxmlNodeSha1(bxml, sha20Bytes);
    lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml82_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml82_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);

    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 12
0
//////////
// #07 - Append attributes (append and prepend)
//////
bool iivvmt_testBxml_7(u64 lnHandleLog, SBxml* bxml)
{
    u64			lnSha1As64Bit;
    u32			lnSha1As32Bit;
    SBxmla*		bxmlaAppend;
    SBxmla*		bxmlaPrepend;
    SBxmla*		bxmlaReference;
    SDatum		wildcardSearch;
    u8			sha20Bytes[_SHA1_NUMBER_SIZE];


    //////////
    // Tell which test we're running
    //////
    printf("\tAppend attributes...");


    //////////
    // Create the prepend node to add
    //////
    bxmlaPrepend = vvm_bxmlaCreate((s8*)cgcTestBxml7PrependAttributeName,	sizeof(cgcTestBxml7PrependAttributeName) - 1, NULL, 0, 7);
    if (!bxmlaPrepend)
    {
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Create the append node to add
    //////
    bxmlaAppend = vvm_bxmlaCreate((s8*)cgcTestBxml7AppendAttributeName,	sizeof(cgcTestBxml7AppendAttributeName) - 1, NULL, 0, 7);
    if (!bxmlaAppend)
    {
        // Failure
        vvm_bxmlaDelete(bxmlaPrepend, true);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Prepend and append the items appropriately
    //////
    wildcardSearch.data._cs8	= cgcTestBxml7FindChildAttribute;
    wildcardSearch.length		= sizeof(cgcTestBxml7FindChildAttribute) - 1;
    vvm_bxmlFindFirst(bxml, NULL, &bxmlaReference, &wildcardSearch, true, true, NULL);
    if (!bxmlaReference)
    {
        // Failure, node wasn't found
        vvm_bxmlaDelete(bxmlaPrepend,	true);
        vvm_bxmlaDelete(bxmlaAppend,	true);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // Insert one before and after that node
    vvm_bxmlaInsertExisting(bxmlaReference->_parent, bxmlaReference, bxmlaPrepend, false);
// vvm_bxmlSave(bxml, "c:\\temp\\bxml_aprepend.bxml", -1, true, true, NULL);
    vvm_bxmlaInsertExisting(bxmlaReference->_parent, bxmlaReference, bxmlaAppend, true);
// vvm_bxmlSave(bxml, "c:\\temp\\bxml_aappend.bxml", -1, true, true, NULL);
    // Note, at this point we leave them installed in the original bxml file, where they are


    //////////
    // Compute the SHA-1
    //////
    lnSha1As64Bit	= vvm_bxmlNodeSha1(bxml, sha20Bytes);
    lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml71_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml71_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 13
0
//////////
//
// This test adds the "1" nodes, which make the former "1" nodes become "2" nodes, as they are
// 2 hops away from root.
//	 ____ ____ ____ ____ ____ 
//	| p2 | p1 |root| n1 | n2 |
//	|____|____|____|____|____|
//
//////
	bool iivvmt_testSll_2(u64 lnHandleLog, SLL* root)
	{
		SLLCallback		cb;
		u64				lnSha1As64Bit;
		u32				lnSha1As32Bit;
		u8				sha20Bytes[20];
		u8				context[92];
		SLL*			nodePrev;
		SLL*			nodeNext;


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL_APPEND);


		//////////
		// Prepare for our callbacks
		//////
			cb._func	= (u64)&i3vvmt_testSll_1_sha1Callback;
			cb.node		= root->prev;
			cb.extra1	= (u64)&context[0];
			cb.extra2	= (u64)&sha20Bytes[0];


		//////////
		// Create a node to go before
		//////
			nodePrev = i3vvmt_testSll_1_createSll(cgnLlBufferSize);
			if (!nodePrev)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go after
		//////
			nodeNext = i3vvmt_testSll_1_createSll(cgnLlBufferSize);
			if (!nodeNext)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Insert the node after
		//////
			vvm_ll_insert(nodeNext, root, true);


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			vvm_ll_iterateViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl5NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl5NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node before
		//////
			vvm_ll_insert(nodePrev, root, false);


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodePrev->prev;
			vvm_ll_iterateViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl6NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl6NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNext->next;
			vvm_ll_iterateBackwardViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl7NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl7NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 14
0
//////////
// #04 - Search for nodes, attributes, and data
//////
bool iivvmt_testBxml_4(u64 lnHandleLog, SBxml* bxml)
{
    u64				lnSha1As64Bit;
    u32				lnSha1As32Bit, lnCount, lnCountAttributes, lnDataCount;
    void*			x;
    u8				sha20Bytes[_SHA1_NUMBER_SIZE];
    u8				context[_SHA1_CONTEXT_SIZE];
    SBxml*			bxmlReference;
    SDatum			wildcardSearch;
    SDatum			wildcardSearchAttributes;
    SDatum			wildcardSearchData;
    SStartEnd		bxmlFinds;
    SStartEnd		bxmlaFinds;
    SStartEnd		bxmlDataFinds;


    //////////
    // Tell which test we're running
    //////
    printf("\tSearch nodes, attributes, data...");


    //////////
    // Initialize
    //////
    wildcardSearch.data._cs8			= cgcTestBxml4FindChildNode;
    wildcardSearch.length				= sizeof(cgcTestBxml4FindChildNode) - 1;
    wildcardSearchAttributes.data._cs8	= cgcTestBxml4FindAttributes;
    wildcardSearchAttributes.length		= sizeof(cgcTestBxml4FindAttributes) - 1;
    wildcardSearchData.data._cs8		= cgcTestBxml4FindData;
    wildcardSearchData.length			= sizeof(cgcTestBxml4FindData) - 1;
    x									= NULL;
    lnCount								= -1;
    lnDataCount							= -1;
    memset(&bxmlFinds, 0, sizeof(bxmlFinds));
    memset(&bxmlaFinds, 0, sizeof(bxmlaFinds));
    memset(&bxmlDataFinds, 0, sizeof (bxmlDataFinds));


    //////////
    // Find our first *child* reference
    //////
    if (!vvm_bxmlFindFirst(bxml, &bxmlReference, NULL, &wildcardSearch, true, false, &x))
    {
        // Was not found, error
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }
    vvm_sha1ComputeSha1(bxmlReference->_name.data._s8, (u32)bxmlReference->_name.length, sha20Bytes);
    lnSha1As64Bit = vvm_sha1Compute64BitFromSha1(sha20Bytes);
    lnSha1As32Bit = vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml41_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml41_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Get the count of how many items are found in total
    //////
    u32 lnFinds = 1;
    while (vvm_bxmlFindContinue(x))
        ++lnFinds;

    // We should've found 13 separate instances throughout looking for "*child*" (includes child, grandchild, ggrandchild, child2, etc.)
    if (lnFinds != 13)
    {
        // The appropriate number was not found
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Get the node and attribute name finds as lists, compute their SHA-1 values
    //////
    vvm_sha1ComputeSha1_Start(context);
    vvm_bxmlFindAllAsStartEndLists(bxml, &bxmlFinds,	NULL,			&wildcardSearch,			&lnCount,			true, true);
    vvm_bxmlFindAllAsStartEndLists(bxml, NULL,			&bxmlaFinds,	&wildcardSearchAttributes,	&lnCountAttributes,	true, true);

    // Compute SHA-1 of bxml node finds
    SStartEndCallback cb;
    cb._func = (u64)&iivvmt_testBxml_computeSha1CallbackBxml;
    cb.extra = (u64)&context[0];
    vvm_SEChain_iterateThroughForCallback(&bxmlFinds, &cb);
    vvm_SEChain_delete(&bxmlFinds, 0, 0, false);

    // And continue by computing SHA-1 of bxmla attribute name finds on top of the just computed SHA-1 from bxml node finds
    cb._func = (u64)&iivvmt_testBxml_computeSha1CallbackBxmla;
    vvm_SEChain_iterateThroughForCallback(&bxmlaFinds, &cb);
    vvm_SEChain_delete(&bxmlaFinds, 0, 0, false);

    // Determine the SHA-1 based on the finds
    vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, true);
    lnSha1As64Bit = vvm_sha1Compute64BitFromSha1(sha20Bytes);
    lnSha1As32Bit = vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml42_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml42_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    //////////
    // Get the attribute data finds as lists, compute their sha1 values
    //////
    vvm_sha1ComputeSha1_Start(context);
    vvm_bxmlDataFindAllAsStartEndList(bxml, &bxmlaFinds, &wildcardSearchData, &lnDataCount, true);

    // Compute SHA-1 of bxmla attribute data finds
    cb._func = (u64)&iivvmt_testBxml_computeSha1CallbackBxmlaData;
    vvm_SEChain_iterateThroughForCallback(&bxmlDataFinds, &cb);
    vvm_SEChain_delete(&bxmlDataFinds,	0, 0, false);

    // Determine the SHA-1 based on the finds
    vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, true);
    lnSha1As64Bit = vvm_sha1Compute64BitFromSha1(sha20Bytes);
    lnSha1As32Bit = vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxml43_Sha1As64Bit || lnSha1As32Bit != cgnTestBxml43_Sha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }


    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 15
0
//////////
// #02 - Save the processed bxml file to disk (should match cgc_Test_Bxml_2_1 in Bxml_test2.h)
//////
bool iivvmt_testBxml_2(u64 lnHandleLog, SBxml* bxml)
{
    u64		lnBytesWritten, lnBytesRead, lnErrorOffset, lnErrorCode, lnSha1As64Bit;
    u32		lnSha1As32Bit;
    u8		sha20Bytes[20];
    s8*		lcFileOut;
    SBxml*	bxml2;


    // Tell which test we're running
    vvm_resourcePrintf(IDS_VVM_TEST_BXML_2);

    // Save the current state to see how she fared
    lcFileOut = oss_sharedAsciiGetTempFilename();
    if (!lcFileOut)
    {
        // Unable to allocate the temporary filename
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_UNABLE_TO_GET_TEMP_FILE);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }

    // Save the file to disk
    vvm_bxmlSave(bxml, lcFileOut, sizeof(lcFileOut) - 1, true, true, &lnBytesWritten);

    // Try to read it back in, and compare the memory
    bxml2 = vvm_bxmlLoad(lcFileOut, strlen(lcFileOut), &lnBytesRead, &lnErrorOffset, &lnErrorCode);

    // Clean house
    oss_sharedAsciiDeleteFile(lcFileOut);
    oss_free(lcFileOut);

    // Did we read it back in correctly?
    if (!bxml2 || lnErrorCode != 0 || lnBytesRead != lnBytesWritten)
    {
        // Unable to load the temporary file back in correctly
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_UNABLE_TO_RELOAD_TEMP_FILE);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }
    // If we get here, file was loaded properly

    // Grab the SHA-1 value from the loaded file
    lnSha1As64Bit	= vvm_bxmlNodeSha1(bxml2, sha20Bytes);
    lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
    if (lnSha1As64Bit != cgnTestBxmlDotHNodeSha1As64Bit || lnSha1As32Bit != cgnTestBxmlDotHNodeSha1As32Bit)
    {
        // The file does not match the expected SHA-1 value
        vvm_resourcePrintf(IDS_VVM_TEST_BXML_RELOAD_DOES_NOT_MATCH);
        vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
        return(false);
    }
    // If we get here, we're good, the re-loaded file matched the form with which it was
    // saved, and the SHA-1 validation upon reload indicated they were identical.
    // In short, it's time to do a little dance! Woo hoo! :-)

    // Delete the loaded node
    vvm_bxmlNodeDelete(bxml2, true);
    bxml2 = NULL;

    // If we get here, we're good
    vvm_resourcePrintf(IDS_VVM_TEST_PASS);
    return(true);
}
Ejemplo n.º 16
0
	//////////
	// #01 - Create a canvas, give it a gradient, scale it a couple times and validate SHA-1s
	//////
		bool iivvmt_testCanvas_1(u64 lnHandleLog)
		{
			SRGBA		ul, ur, lr, ll;
			u64			lnSha1As64Bit;
			u32			lnSha1As32Bit;
			u8			sha20Bytes[20];
			SCanvas*	canvas;
			SCanvas*	canvasScaled1;
			SCanvas*	canvasScaled2;


			// Tell which test we're running
			vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_1);


			//////////
			// Create the standard canvas
			//////
				canvas = oss_requestCanvas(0, 640, 480, rgba(0,0,0,255), true, true);
				if (!canvas)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Create a canvas for scaling
			//////
				canvasScaled1 = oss_requestCanvas(0, 517, 799, rgba(0,0,0,255), true, true);
				if (!canvasScaled1)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Create another canvas for scaling
			//////
				canvasScaled2 = oss_requestCanvas(0, 128, 16, rgba(0,0,0,255), true, true);
				if (!canvasScaled2)
				{
					// Failure creating the canvas
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_CANNOT_CREATE);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Perform a gradient
			//////
				ul.color	= rgba(255, 255, 255, 255);		// white
				ur.color	= rgba(255,   0,   0, 255);		// red
				lr.color	= rgba(  0, 255,   0, 255);		// green
				ll.color	= rgba(  0,   0, 255, 255);		// blue
				oss_canvasGradient(canvas, canvas->bd, ul, ur, lr, ll);
				// For debugging:
				oss_saveBitmapToDisk(canvas, canvas->bd, "\\temp\\gradient.bmp");


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvas->bd, canvas->width * canvas->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test1_Canvas_Sha1As64Bit || lnSha1As32Bit != cgn_Test1_Canvas_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Scale the gradient
			//////
				oss_canvasScale(canvasScaled1, canvas);
				// For debugging:
				oss_saveBitmapToDisk(canvasScaled1, canvasScaled1->bd, "\\temp\\gradientScaled1.bmp");


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvasScaled1->bd, canvasScaled1->width * canvasScaled1->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test1_CanvasScaled1_Sha1As64Bit || lnSha1As32Bit != cgn_Test1_CanvasScaled1_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			//////////
			// Scale the gradient
			//////
				oss_canvasScale(canvasScaled2, canvas);
				// For debugging:
				oss_saveBitmapToDisk(canvasScaled2, canvasScaled2->bd, "\\temp\\gradientScaled2.bmp");


			//////////
			// Was it valid?
			//////
				oss_sha1ComputeSha1((s8*)canvasScaled2->bd, canvasScaled2->width * canvasScaled2->height * sizeof(SRGBA), sha20Bytes);
				lnSha1As64Bit = oss_sha1Compute64BitFromSha1(sha20Bytes);
				lnSha1As32Bit = oss_sha1Compute32BitFromSha1(sha20Bytes);
				if (lnSha1As64Bit != cgn_Test1_CanvasScaled2_Sha1As64Bit || lnSha1As32Bit != cgn_Test1_CanvasScaled2_Sha1As32Bit)
				{
					// The gradient does not match the expected SHA-1 value
					vvm_resourcePrintf(IDS_VVM_TEST_CANVAS_SCALED_INVALID_GRADIENT);
					vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
					return(false);
				}


			// If we get here, we're good
			vvm_resourcePrintf(IDS_VVM_TEST_PASS);
			return(true);
		}
Ejemplo n.º 17
0
	bool iivvmt_testSll_3(u64 lnHandleLog, SLL** root)
	{
		SLLCallback		cb;
		u64				lnSha1As64Bit;
		u32				lnSha1As32Bit;
		u8				sha20Bytes[20];
		u8				context[92];
		SLL*			nodePrev;


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL_DELETE);


		//////////
		// Prepare for our callbacks
		//////
			cb._func	= (u64)&i3vvmt_testSll_1_sha1Callback;
			cb.node		= (*root)->prev;
			cb.extra1	= (u64)&context[0];
			cb.extra2	= (u64)&sha20Bytes[0];


		//////////
		// Delete the first node
		//////
			vvm_ll_delete((*root)->prev->prev);


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			vvm_ll_iterateViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl8NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl8NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete the last node
		//////
			vvm_ll_delete((*root)->next->next);


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = (*root)->prev;
			vvm_ll_iterateViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl9NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl9NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete the last node
		//////
			// Get what will become the new root, which is the first item
			nodePrev = (*root)->prev;

			// Delete the middle node
			vvm_ll_delete(*root);

			// Store the new root
			*root = nodePrev;


		//////////
		// Determine the SHA-1 on the remaining two nodes going forward
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodePrev;
			vvm_ll_iterateViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl10NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl10NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Determine the SHA-1 on the remaining two nodes going backward
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodePrev->next;
			vvm_ll_iterateBackwardViaCallback(&cb);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTestLl11NodeSha1As64Bit || lnSha1As32Bit != cgnTestLl11NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good



		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 18
0
	bool iivvmt_testSha1_1(u64 lnHandleLog)
	{
		// Used for test #3
		u32		lnI;
		u8		context[96];


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SHA1_FIPS_PUB_180_1);


		//////////
		// "abc"
		// A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
		//////
			vvm_resourcePrintf(IDS_VVM_1DOTDOTDOT);
			vvm_sha1ComputeSha1AsHex((s8*)cgc_Test_Sha1_1_1, sizeof(cgc_Test_Sha1_1_1) - 1, cgc_Test_Sha1_1_3, true);;
			if (vvm_memicmp(_csu8p(cgc_Test_Sha1_1_2), _csu8p(cgc_Test_Sha1_1_3), sizeof(cgc_Test_Sha1_1_2) - 1) != 0)
			{
failure:
				// Error
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);

				// Indicate we failed
				return false;
			}


		//////////
		// "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
		// 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
		//////
			vvm_resourcePrintf(IDS_VVM_2DOTDOTDOT);
			vvm_sha1ComputeSha1AsHex((s8*)cgc_Test_Sha1_2_1, sizeof(cgc_Test_Sha1_2_1) - 1, cgc_Test_Sha1_2_3, true);;
			if (vvm_memicmp(_csu8p(cgc_Test_Sha1_2_2), _csu8p(cgc_Test_Sha1_2_3), sizeof(cgc_Test_Sha1_2_2) - 1) != 0)
				goto failure;		// Failure


		//////////
		// A million repetitions of "a"
		// 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
		//////
			vvm_resourcePrintf(IDS_VVM_3DOTDOTDOT);

			// Initialize
			vvm_sha1ComputeSha1_Start(context);

			// Process one million lower-case "a" characters in succession, one at a time
			for (lnI = 0; lnI < 1000000; lnI++)
				vvm_sha1ComputeSha1_ProcessThisData(context, (s8*)cgc_Test_Sha1_3_1, sizeof(cgc_Test_Sha1_3_1) - 1);

			// Finalize and compute the value a hex
			vvm_sha1ComputeSha1_FinishAsHex(context, cgc_Test_Sha1_3_3, true, true);
			if (vvm_memicmp(_csu8p(cgc_Test_Sha1_3_2), _csu8p(cgc_Test_Sha1_3_3), sizeof(cgc_Test_Sha1_3_2) - 1) != 0)
				goto failure;		// Failure


		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 19
0
//////////
//
// #03 - Delete everything in pieces and in chains
//
//////
	bool iivvmt_testSll4_3(u64 lnHandleLog, SLL4** root)
	{
		SLL4Callback	cb;
		u64				lnSha1As64Bit;
		u32				lnSha1As32Bit;
		u8				sha20Bytes[20];
		u8				context[92];
		SLL4*			ll4x1;
		SLL4*			ll4x2;
		SLL4*			ll4x3;
		SLL4*			ll4x4;
		SLL4*			ll4x5;
		SLL4*			ll4w1;
		SLL4*			ll4w2;
		SLL4*			ll4e1;
		SLL4*			ll4e2;
		SLL4*			ll4n1;
		SLL4*			ll4n2;
		SLL4*			ll4s1;
		SLL4*			ll4s2;


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL4_DELETE);


		///////////
		// Verify we still have our root setup properly
		//////
			// Check w2..root
			if (!(*root)->west || !(*root)->west->west || !(*root)->west->west->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..e2
			if (!(*root)->east || !(*root)->east->east || (*root)->east->east->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..n2
			if (!(*root)->north || !(*root)->north->north || (*root)->north->north->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..s2
			if (!(*root)->south || !(*root)->south->south || (*root)->south->south->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab w2 by navigation the chain
			ll4x1 = vvm_ll4_getLastNode(*root, _LL4_WEST);
			if (ll4x1 != (*root)->west->west->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab w2
			ll4w2 = ll4x1->east;
			if (ll4w2 != (*root)->west->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab w1
			ll4w1 = ll4w2->east;
			if (ll4w1 != (*root)->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab e2 by navigation the chain
			ll4e2 = vvm_ll4_getLastNode(*root, _LL4_EAST);
			if (ll4e2 != (*root)->east->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab e1
			ll4e1 = ll4e2->west;
			if (ll4e1 != (*root)->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab n2 by navigation the chain
			ll4n2 = vvm_ll4_getLastNode(*root, _LL4_NORTH);
			if (ll4n2 != (*root)->north->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab n1
			ll4n1 = ll4n2->south;
			if (ll4n1 != (*root)->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab s2 by navigation the chain
			ll4s2 = vvm_ll4_getLastNode(*root, _LL4_SOUTH);
			if (ll4s2 != (*root)->south->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab s1
			ll4s1 = ll4s2->north;
			if (ll4s1 != (*root)->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab each item down from ll4x1
			if (!ll4x1->south || !ll4x1->south->south || !ll4x1->south->south->south || !ll4x1->south->south->south->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			ll4x2 = ll4x1->south;
			ll4x3 = ll4x2->south;
			ll4x4 = ll4x3->south;
			ll4x5 = ll4x4->south;


		//////////
		// Delete x2
		//////
			vvm_ll4_delete(ll4x2);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4x1;
			cb.extra1	= (u64)&context[0];
			cb.extra2	= (u64)&sha20Bytes[0];
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node		= ll4x5;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll43NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll43NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete x5
		//////
			vvm_ll4_delete(ll4x5);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4x1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node		= ll4x4;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll44NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll44NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete x3
		//////
			vvm_ll4_delete(ll4x3);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4x1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node		= ll4x4;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll45NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll45NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete x4
		//////
			vvm_ll4_delete(ll4x4);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4x1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll46NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll46NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete x1
		//////
			vvm_ll4_delete(ll4x1);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4e2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll47NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll47NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete e2
		//////
			vvm_ll4_delete(ll4e2);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4e1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			cb.node		= ll4w2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll48NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll48NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete w1
		//////
			vvm_ll4_delete(ll4w1);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4e1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			cb.node		= ll4w2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll49NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll49NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete e1 and chain east
		//////
			vvm_ll4_deleteChain(&ll4e1, _LL4_EAST);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			cb.node		= ll4w2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll410NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll410NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete w2 and chain west
		//////
			vvm_ll4_deleteChain(&ll4w2, _LL4_WEST);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll411NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll411NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete n1 and chain north
		//////
			vvm_ll4_deleteChain(&ll4n1, _LL4_NORTH);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4s2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll412NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll412NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete s1 and chain south
		//////
			vvm_ll4_deleteChain(&ll4s1, _LL4_SOUTH);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll413NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll413NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Delete root and chain south
		//////
			vvm_ll4_deleteChain(root, _LL4_SOUTH);
			if (*root)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE_AFTER_DELETE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 20
0
//////////
//
// The 4-way link-list will be of the w2..e2 and n2..s2 form.  This process creates a north/south
// chain and inserts it west of w2, calling it x1..x5.  After doing this, it deletes x2, then x5,
// then x3, then x4, leaving x1.  Then it deletes x1, e2, w1, then the chain east from e1, and west
// from w2.  Then it deletes the chain north from n1, and south from s1, leaving only root.
//
//	                    ____ north
//	                   | n2 |
//	                   |____|
//	                   | n1 |
//	     ____ ____ ____|____|____ ____ 
//	    | x1 | w2 | w1 |root| e1 | e2 |
//	    |____|____|____|____|____|____|
//	    | x2 |west     | s1 |      east
//	    |____|         |____|
//	    | x3 |         | s2 |
//	    |____|         |____|
//	    | x4 |               south
//	    |____|
//	    | x5 |
//	    |____|
//
//////
	bool iivvmt_testSll4_2(u64 lnHandleLog, SLL4* root)
	{
		SLL4Callback	cb;
		u64				lnSha1As64Bit;
		u32				lnSha1As32Bit;
		u8				sha20Bytes[20];
		u8				context[92];
		u32				lnCount;
		SLL4*			ll4x1;
		SLL4*			ll4w1;
		SLL4*			ll4w2;
		SLL4*			ll4e1;
		SLL4*			ll4e2;
		SLL4*			ll4n1;
		SLL4*			ll4n2;
		SLL4*			ll4s1;
		SLL4*			ll4s2;


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL4_APPEND);


		///////////
		// Verify we still have our root setup properly
		//////
			// Check w2..root
			if (!root->west || !root->west->west || root->west->west->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..e2
			if (!root->east || !root->east->east || root->east->east->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..n2
			if (!root->north || !root->north->north || root->north->north->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Check root..s2
			if (!root->south || !root->south->south || root->south->south->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CORRUPT_ROOT_STRUCTURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab w2 by navigation the chain
			ll4w2 = vvm_ll4_getLastNode(root, _LL4_WEST);
			if (ll4w2 != root->west->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab w1
			ll4w1 = ll4w2->east;
			if (ll4w1 != root->west)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab e2 by navigation the chain
			ll4e2 = vvm_ll4_getLastNode(root, _LL4_EAST);
			if (ll4e2 != root->east->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab e1
			ll4e1 = ll4e2->west;
			if (ll4e1 != root->east)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab n2 by navigation the chain
			ll4n2 = vvm_ll4_getLastNode(root, _LL4_NORTH);
			if (ll4n2 != root->north->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab n1
			ll4n1 = ll4n2->south;
			if (ll4n1 != root->north)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab s2 by navigation the chain
			ll4s2 = vvm_ll4_getLastNode(root, _LL4_SOUTH);
			if (ll4s2 != root->south->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}

			// Grab s1
			ll4s1 = ll4s2->north;
			if (ll4s1 != root->south)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_NAVIGATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create the chain
		//////
			lnCount	= 5;
			ll4x1	= vvm_ll4_createChain(cgnLl4BufferSize, &lnCount, _LL4_SOUTH);
			if (lnCount != 5 || !ll4x1)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE_CHAIN);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Populate the chain with known data
		//////
			cb._func	= (u64)&i3vvmt_testSll4_initiallyPopulateCallback;
			cb.node		= ll4x1;
			cb.extra1	= (u64)&context[0];
			cb.extra2	= (u64)&sha20Bytes[0];
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);


		//////////
		// Validate that it was setup and populated correctly
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4x1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll41NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll41NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Attach x1 onto w2's west, and validate it's on there good
		//////
			vvm_ll4_insertWestEast(ll4x1, ll4w2, false);

			vvm_sha1ComputeSha1_Start(context);
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.node		= ll4e2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			cb.node		= ll4x1;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest2Ll42NodeSha1As64Bit || lnSha1As32Bit != cgnTest2Ll42NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		// If we get here, we're good, only root remains
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}
Ejemplo n.º 21
0
//////////
//
// The 4-way link-list test builds everything off the root.  It first adds the "2" nodes,
// which initially occupy the positions immediate off root.  It then adds the "1" nodes, which
// are inserted between the "2" nodes and root in each direction.
//
//	           ____ north
//	          | n2 |
//	          |____|
//	          | n1 |
//	 ____ ____|____|____ ____ 
//	| w2 | w1 |root| e1 | e2 |
//	|____|____|____|____|____|
//	west      | s1 |      east
//	          |____|
//	          | s2 |
//	          |____|
//       south
//////
	bool iivvmt_testSll4_1(u64 lnHandleLog, SLL4** root)
	{
		SLL4Callback	cb;
		u64				lnSha1As64Bit;
		u32				lnSha1As32Bit;
		u8				sha20Bytes[20];
		u8				context[92];
		SLL4*			nodeNorth2;
		SLL4*			nodeSouth2;
		SLL4*			nodeWest2;
		SLL4*			nodeEast2;
		SLL4*			nodeNorth1;
		SLL4*			nodeSouth1;
		SLL4*			nodeWest1;
		SLL4*			nodeEast1;


		//////////
		// Tell them which test we're running
		//////
			vvm_resourcePrintf(IDS_VVM_TEST_SLL4_CREATE);


		//////////
		// Create a single node
		//////
			*root = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!*root)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// Initialize our callback data
			cb._func	= (u64)&i3vvmt_testSll4_1_sha1Callback;
			cb.extra1	= (u64)&context[0];
			cb.extra2	= (u64)&sha20Bytes[0];


		//////////
		// Determine the SHA-1 on that one node
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll41NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll41NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Create a node to go to the west
		//////
			nodeWest2 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeWest2)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the east
		//////
			nodeEast2 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeEast2)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the north
		//////
			nodeNorth2 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeNorth2)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the south
		//////
			nodeSouth2 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeSouth2)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Insert the node to the west
		//////
			vvm_ll4_insertWestEast(nodeWest2, *root, false);


		//////////
		// Determine the SHA-1 on the two nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll42NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll42NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the east
		//////
			vvm_ll4_insertWestEast(nodeEast2, *root, true);


		//////////
		// Determine the SHA-1 on the three nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll43NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll43NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the north
		//////
			vvm_ll4_insertNorthSouth(nodeNorth2, *root, false);


		//////////
		// Determine the SHA-1 on the two nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = *root;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll44NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll44NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the south
		//////
			vvm_ll4_insertNorthSouth(nodeSouth2, *root, true);


		//////////
		// Determine the SHA-1 on the three nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = nodeSouth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll45NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll45NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Create a node to go to the west
		//////
			nodeWest1 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeWest1)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the east
		//////
			nodeEast1 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeEast1)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the north
		//////
			nodeNorth1 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeNorth1)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Create a node to go to the south
		//////
			nodeSouth1 = i3vvmt_testSll4_1_createSll4(cgnLl4BufferSize);
			if (!nodeSouth1)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_UNABLE_TO_CREATE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}


		//////////
		// Insert the node to the west
		//////
			vvm_ll4_insertWestEast(nodeWest1, *root, false);


		//////////
		// Determine the SHA-1 on the two nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = nodeSouth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll46NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll46NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the east
		//////
			vvm_ll4_insertWestEast(nodeEast1, *root, true);


		//////////
		// Determine the SHA-1 on the three nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = nodeSouth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll47NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll47NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the north
		//////
			vvm_ll4_insertNorthSouth(nodeNorth1, *root, false);


		//////////
		// Determine the SHA-1 on the two nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = nodeSouth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll48NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll48NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		//////////
		// Insert the node to the south
		//////
			vvm_ll4_insertNorthSouth(nodeSouth1, *root, true);


		//////////
		// Determine the SHA-1 on the three nodes
		//////
			vvm_sha1ComputeSha1_Start(context);
			cb.node = nodeNorth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_SOUTH);
			cb.node = nodeSouth2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_NORTH);
			cb.node = nodeWest2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_EAST);
			cb.node = nodeEast2;
			vvm_ll4_iterateViaCallback(&cb, _LL4_WEST);
			vvm_sha1ComputeSha1_FinishAsSha1(context, sha20Bytes, false);
			vvm_sha1Compute64BitFromSha1(sha20Bytes);

			lnSha1As64Bit	= vvm_sha1Compute64BitFromSha1(sha20Bytes);
			lnSha1As32Bit	= vvm_sha1Compute32BitFromSha1(sha20Bytes);
			if (lnSha1As64Bit != cgnTest1Ll49NodeSha1As64Bit || lnSha1As32Bit != cgnTest1Ll49NodeSha1As32Bit)
			{
				// Failure
				vvm_resourcePrintf(IDS_VVM_TEST_SLL4_SHA1_FAILURE);
				vvm_resourcePrintf(IDS_VVM_TEST_FAIL);
				return(false);
			}
			// If we get here, we're good


		// If we get here, we're good
		vvm_resourcePrintf(IDS_VVM_TEST_PASS);
		return(true);
	}