kerneltest/e32test/dmav2/self_test.cpp
changeset 139 95f71bcdcdb7
parent 36 538db54a451d
child 199 189ece41fa29
equal deleted inserted replaced
109:b3a1d9898418 139:95f71bcdcdb7
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    47 	if(gVerboseOutput)
    47 	if(gVerboseOutput)
    48 	{
    48 	{
    49 	Print(testInfo);
    49 	Print(testInfo);
    50 	}
    50 	}
    51 
    51 
    52 	test.Next(_L("Channel open"));
    52 	// Self test just needs 1 channel
       
    53 	// The real test will test all available ones
       
    54 	test.Next(_L("Select test channel"));
       
    55 	TUint testChannel = 0;
       
    56 	if(testInfo.iMaxSbChannels > 0)
       
    57 		{
       
    58 		testChannel = testInfo.iSbChannels[0];
       
    59 		}
       
    60 	else if(testInfo.iMaxDbChannels > 0)
       
    61 		{
       
    62 		testChannel = testInfo.iDbChannels[0];
       
    63 		}
       
    64 	else if(testInfo.iMaxSgChannels > 0)
       
    65 		{
       
    66 		testChannel = testInfo.iSgChannels[0];
       
    67 		}
       
    68 	else
       
    69 		{
       
    70 		test.Printf(_L("Driver exposes no channels to test"));
       
    71 		test(EFalse);
       
    72 		}
       
    73 
       
    74 	test.Printf(_L("using PSL cookie %d (0x%08x)\n"), testChannel, testChannel);
       
    75 	test.Next(_L("Open channel"));
    53 	TUint channelCookie=0;
    76 	TUint channelCookie=0;
    54 	r = session.ChannelOpen(16, channelCookie);
    77 	r = session.ChannelOpen(testChannel, channelCookie);
    55 	test.Printf(_L("cookie recived = 0x%08x\n"), channelCookie);
    78 	test.Printf(_L("cookie recived = 0x%08x\n"), channelCookie);
    56 	test_KErrNone(r);
    79 	test_KErrNone(r);
    57 
    80 
    58 	test.Next(_L("Get Channel caps"));
    81 	test.Next(_L("Get Channel caps"));
    59 	SDmacCaps channelCaps;
    82 	SDmacCaps channelCaps;
    97 
   120 
    98 	const TBool newPil = (extChannelCaps.iPILVersion > 1);
   121 	const TBool newPil = (extChannelCaps.iPILVersion > 1);
    99 
   122 
   100 	test.Next(_L("Create Dma request - max fragment size 32K"));
   123 	test.Next(_L("Create Dma request - max fragment size 32K"));
   101 	TUint reqCookie=0;
   124 	TUint reqCookie=0;
   102 	r = session.RequestCreate(channelCookie, reqCookie, 32 * KKilo);
   125 	r = session.RequestCreateOld(channelCookie, reqCookie, 32 * KKilo);
   103 	test.Printf(_L("cookie recived = 0x%08x\n"), reqCookie);
   126 	test.Printf(_L("cookie recived = 0x%08x\n"), reqCookie);
   104 	test_KErrNone(r);
   127 	test_KErrNone(r);
   105 
   128 
   106 	if(newPil)
   129 	if(newPil)
   107 		{
   130 		{
   108 		test.Next(_L("Create Dma request (with new-style callback)"));
   131 		test.Next(_L("Create Dma request (with new-style callback)"));
   109 		TUint reqCookieNewStyle=0;
   132 		TUint reqCookieNewStyle=0;
   110 		r = session.RequestCreateNew(channelCookie, reqCookieNewStyle);
   133 		r = session.RequestCreate(channelCookie, reqCookieNewStyle);
   111 		test.Printf(_L("cookie recived = 0x%08x\n"), reqCookieNewStyle );
   134 		test.Printf(_L("cookie recived = 0x%08x\n"), reqCookieNewStyle );
   112 		test_KErrNone(r);
   135 		test_KErrNone(r);
   113 
   136 
   114 		test.Next(_L("Fragment for ISR callback"));
   137 		test.Next(_L("Fragment for ISR callback"));
   115 		const TInt size = 128 * KKilo;
   138 		const TInt size = 128 * KKilo;
   269 const TDmacTestCaps KDmacTestCapsV2(KTestCapSet, 2);
   292 const TDmacTestCaps KDmacTestCapsV2(KTestCapSet, 2);
   270 
   293 
   271 void TDmaCapability::SelfTest()
   294 void TDmaCapability::SelfTest()
   272 	{
   295 	{
   273 	test.Start(_L("Unit test_Value of TDmaCapability::CompareToDmaCaps\n"));
   296 	test.Start(_L("Unit test_Value of TDmaCapability::CompareToDmaCaps\n"));
   274 
       
   275 	{
       
   276 	test.Next(_L("ENone\n"));
       
   277 	TResult t = none.CompareToDmaCaps(KTestCapSet);
       
   278 	test_Value(t, t == ERun);
       
   279 	}
       
   280 
       
   281 	{
       
   282 	test.Next(_L("EChannelPauseAndResume - wanted\n"));
       
   283 	TResult t = pauseRequired.CompareToDmaCaps(KTestCapSet);
       
   284 	test_Value(t, t == EFail);
       
   285 	}
       
   286 	{
       
   287 	test.Next(_L("EChannelPauseAndResume - wanted - Allow skip\n"));
       
   288 	TResult t = pauseRequired_skip.CompareToDmaCaps(KTestCapSet);
       
   289 	test_Value(t, t == ESkip);
       
   290 	}
       
   291 	{
       
   292 	test.Next(_L("EChannelPauseAndResume - not wanted\n"));
       
   293 	TResult t = pauseNotWanted.CompareToDmaCaps(KTestCapSet);
       
   294 	test_Value(t, t == ERun);
       
   295 	}
       
   296 
       
   297 	{
       
   298 	test.Next(_L("EHwDescriptors - not wanted\n"));
       
   299 	TResult t = hwDesNotWanted.CompareToDmaCaps(KTestCapSet);
       
   300 	test_Value(t, t == EFail);
       
   301 	}
       
   302 
       
   303 	{
       
   304 	test.Next(_L("EHwDescriptors - not wanted - Allow skip\n"));
       
   305 	TResult t = hwDesNotWanted_skip.CompareToDmaCaps(KTestCapSet);
       
   306 	test_Value(t, t == ESkip);
       
   307 	}
       
   308 
       
   309 	{
       
   310 	test.Next(_L("EHwDescriptors - wanted\n"));
       
   311 	TResult t = hwDesWanted.CompareToDmaCaps(KTestCapSet);
       
   312 	test_Value(t, t == ERun);
       
   313 	}
       
   314 
       
   315 
       
   316 //TODO use this macro for the above tests
       
   317 
       
   318 // Note: The construction of the test description message
   297 // Note: The construction of the test description message
   319 // is horribly confusing. The _L macro will make the
   298 // is horribly confusing. The _L macro will make the
   320 // *first* string token wide, but not the next two.
   299 // *first* string token wide, but not the next two.
   321 // Therefore these must be made wide or compilier
   300 // Therefore these must be made wide or compilier
   322 // will complain about concatination of narrow and wide string
   301 // will complain about concatination of narrow and wide string
   326 	test.Next(_L(#CAP L" against " L ## #CAPSET));\
   305 	test.Next(_L(#CAP L" against " L ## #CAPSET));\
   327 	TResult t = (CAP).CompareToDmaCaps(CAPSET);\
   306 	TResult t = (CAP).CompareToDmaCaps(CAPSET);\
   328 	test_Equal(EXPCT, t);\
   307 	test_Equal(EXPCT, t);\
   329 	}
   308 	}
   330 
   309 
       
   310 	CAP_TEST(none, KTestCapSet, ERun);
       
   311 	CAP_TEST(pauseRequired, KTestCapSet, EFail);
       
   312 	CAP_TEST(pauseRequired_skip, KTestCapSet, ESkip);
       
   313 	CAP_TEST(pauseNotWanted, KTestCapSet, ERun);
       
   314 	CAP_TEST(hwDesNotWanted, KTestCapSet, EFail);	
       
   315 	CAP_TEST(hwDesNotWanted_skip, KTestCapSet, ESkip);
       
   316 	CAP_TEST(hwDesWanted, KTestCapSet, ERun);
   331 
   317 
   332 	CAP_TEST(capEqualV1, KDmacTestCapsV1, ERun);
   318 	CAP_TEST(capEqualV1, KDmacTestCapsV1, ERun);
   333 	CAP_TEST(capEqualV2, KDmacTestCapsV2, ERun);
   319 	CAP_TEST(capEqualV2, KDmacTestCapsV2, ERun);
   334 	CAP_TEST(capEqualV1, KDmacTestCapsV2, ESkip);
   320 	CAP_TEST(capEqualV1, KDmacTestCapsV2, ESkip);
   335 	CAP_TEST(capEqualV2, KDmacTestCapsV1, ESkip);
   321 	CAP_TEST(capEqualV2, KDmacTestCapsV1, ESkip);
   343 	test.End();
   329 	test.End();
   344 	}
   330 	}
   345 
   331 
   346 void TTestCase::SelfTest()
   332 void TTestCase::SelfTest()
   347 	{
   333 	{
   348 	//TODO should use macros for these tests
       
   349 	test.Start(_L("Unit test of TTestCase::TestCaseValid\n"));
   334 	test.Start(_L("Unit test of TTestCase::TestCaseValid\n"));
   350 
   335 
   351 	TTestCase testCase(NULL, EFalse, pauseRequired, hwDesNotWanted);
   336 // Create a TTestCase with paramaters CAP1 and CAP2
   352 	test.Next(_L("pauseRequired, hwDesNotWanted\n"));
   337 // call TTestCase::TestCaseValid against CAPSET
   353 	TResult t = testCase.TestCaseValid(KTestCapSet);
   338 // Expected result is EXPCT
   354 	test_Value(t, t == EFail);
   339 #define TEST_TEST_CASE(CAP1, CAP2, CAPSET, EXPCT)\
   355 
   340 	{\
   356 	test.Next(_L("pauseRequired_skip, hwDesNotWanted\n"));
   341 	test.Next(_L(#CAP1 L", " L ## #CAP2 L" -- Against: " L ## #CAPSET L", Expect: " L ## #EXPCT));\
   357 	testCase.iChannelCaps[0] = pauseRequired_skip;
   342 	TTestCase testCase(NULL, EFalse, CAP1, CAP2);\
   358 	t = testCase.TestCaseValid(KTestCapSet);
   343 	testCase.iChannelCaps[0] = (CAP1);\
   359 	test_Value(t, t == EFail);
   344 	TResult t = testCase.TestCaseValid(CAPSET);\
   360 
   345 	test_Equal(EXPCT, t);\
   361 	test.Next(_L("pauseRequired_skip, hwDesNotWanted_skip\n"));
   346 	}
   362 	testCase.iChannelCaps[1] = hwDesNotWanted_skip;
   347 
   363 	t = testCase.TestCaseValid(KTestCapSet);
   348 	TEST_TEST_CASE(pauseRequired, hwDesNotWanted, KTestCapSet, EFail);
   364 	test_Value(t, t == ESkip);
   349 	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted, KTestCapSet, EFail);
   365 
   350 	TEST_TEST_CASE(pauseRequired_skip, hwDesNotWanted_skip, KTestCapSet, ESkip);
   366 	test.Next(_L("pauseNotWanted, hwDesNotWanted_skip\n"));
   351 	TEST_TEST_CASE(pauseNotWanted, hwDesNotWanted_skip, KTestCapSet, ESkip);
   367 	testCase.iChannelCaps[0] = pauseNotWanted;
   352 	TEST_TEST_CASE(pauseNotWanted, hwDesWanted, KTestCapSet, ERun);
   368 	t = testCase.TestCaseValid(KTestCapSet);
   353     TEST_TEST_CASE(pauseNotWanted, none, KTestCapSet, ERun);
   369 	test_Value(t, t == ESkip);
   354 
   370 
   355 	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV1, ESkip);
   371 	test.Next(_L("pauseNotWanted, hwDesWanted\n"));
   356 	TEST_TEST_CASE(pauseNotWanted, capAboveV1, KDmacTestCapsV2, ERun);
   372 	testCase.iChannelCaps[1] = hwDesWanted;
   357 
   373 	t = testCase.TestCaseValid(KTestCapSet);
   358 	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV1, ERun);
   374 	test_Value(t, t == ERun);
   359 	TEST_TEST_CASE(pauseNotWanted, capBelowV2, KDmacTestCapsV2, ESkip);
   375 
   360 
   376 	test.Next(_L("pauseNotWanted\n"));
   361 	// contradictory requirements
   377 	testCase.iChannelCaps[1] = none;
   362 	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV2, ESkip);
   378 	t = testCase.TestCaseValid(KTestCapSet);
   363 	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV2, ESkip);
   379 	test_Value(t, t == ERun);
   364 
   380 
   365 	TEST_TEST_CASE(capAboveV1, capBelowV2, KDmacTestCapsV1, ESkip);
   381 	test.Next(_L("pauseNotWanted + V1 PIL required\n"));
   366 	TEST_TEST_CASE(capBelowV2, capAboveV1, KDmacTestCapsV1, ESkip);
   382 	testCase.iChannelCaps[1] = capAboveV1;
       
   383 	test.Next(_L("Against KDmacTestCapsV1"));
       
   384 	t = testCase.TestCaseValid(KDmacTestCapsV1);
       
   385 	test_Equal(ESkip, t);
       
   386 	test.Next(_L("Against KDmacTestCapsV2"));
       
   387 	t = testCase.TestCaseValid(KDmacTestCapsV2);
       
   388 	test_Equal(ERun, t);
       
   389 
       
   390 	test.Next(_L("pauseNotWanted + >V1 PIL required\n"));
       
   391 	testCase.iChannelCaps[1] = capBelowV2;
       
   392 	test.Next(_L("Against KDmacTestCapsV1"));
       
   393 	t = testCase.TestCaseValid(KDmacTestCapsV1);
       
   394 	test_Equal(ERun, t);
       
   395 	test.Next(_L("Against KDmacTestCapsV2"));
       
   396 	t = testCase.TestCaseValid(KDmacTestCapsV2);
       
   397 	test_Equal(ESkip, t);
       
   398 
   367 
   399 	test.End();
   368 	test.End();
   400 	test.Close();
   369 	test.Close();
   401 	}
   370 	}
   402 
   371 
   459 		}
   428 		}
   460 	}
   429 	}
   461 
   430 
   462 void TCallbackRecord::SelfTest()
   431 void TCallbackRecord::SelfTest()
   463 	{
   432 	{
   464 	test.Start(_L("SeltTest of TCallbackRecord"));
   433 	test.Start(_L("SelfTest of TCallbackRecord"));
   465 
   434 
   466 	test.Next(_L("create default TCallbackRecord record, record2"));
   435 	test.Next(_L("create default TCallbackRecord record, record2"));
   467 	TCallbackRecord record;
   436 	TCallbackRecord record;
   468 	const TCallbackRecord record2;
   437 	const TCallbackRecord record2;
   469 	if(gVerboseOutput)
   438 	if(gVerboseOutput)
   557 void CDmaBenchmark::SelfTest()
   526 void CDmaBenchmark::SelfTest()
   558 	{
   527 	{
   559 	test.Start(_L("SelfTest of CDmaBenchmark"));
   528 	test.Start(_L("SelfTest of CDmaBenchmark"));
   560 	test.Next(_L("MeanResult()"));
   529 	test.Next(_L("MeanResult()"));
   561 
   530 
       
   531 	// The mean of these numbers is 10
   562 	TUint64 results[] = {8, 12, 1, 19, 3, 17, 10};
   532 	TUint64 results[] = {8, 12, 1, 19, 3, 17, 10};
   563 	const TInt count = ARRAY_LENGTH(results);
   533 	const TInt count = ARRAY_LENGTH(results);
   564 
   534 
   565 	CDmaBmFragmentation fragTest(_L("SelfTest"), count, TDmaTransferArgs(), 0);
   535 	CDmaBmFragmentation fragTest(_L("SelfTest"), count, TDmaTransferArgs(), 0);
   566 
   536 
   610 	test(d.Contains(b));
   580 	test(d.Contains(b));
   611 	test(!b.Contains(d));
   581 	test(!b.Contains(d));
   612 
   582 
   613 	test(!a.Contains(b));
   583 	test(!a.Contains(b));
   614 	test(!b.Contains(a));
   584 	test(!b.Contains(a));
       
   585 
       
   586 	test.Next(_L("Test IsFilled()"));
       
   587 	TUint8 buffer[] = {0,0,0,0};
       
   588 	TAddrRange range((TUint)buffer, 4);
       
   589 	test(range.IsFilled(0));
       
   590 	buffer[3] = 1;
       
   591 	test(!range.IsFilled(0));
       
   592 	buffer[2] = 1;
       
   593 	buffer[1] = 1;
       
   594 	buffer[0] = 1;
       
   595 	test(range.IsFilled(1));
       
   596 
   615 	test.End();
   597 	test.End();
   616 	}
   598 	}
   617 
   599 
   618 void TAddressParms::SelfTest()
   600 void TAddressParms::SelfTest()
   619 	{
   601 	{
   645 	const TAddressParms pD(0, 128, 64);
   627 	const TAddressParms pD(0, 128, 64);
   646 	test(pD.Overlaps(pA));
   628 	test(pD.Overlaps(pA));
   647 	test(pD.Overlaps(pB));
   629 	test(pD.Overlaps(pB));
   648 	test(pD.Overlaps(pC));
   630 	test(pD.Overlaps(pC));
   649 	test.End();
   631 	test.End();
       
   632 	}
       
   633 
       
   634 void TIsrRequeArgsSet::SelfTest()
       
   635 	{
       
   636 	test.Start(_L("Selftest of TIsrRequeArgsSet"));
       
   637 
       
   638 	TUint size = 0x1000;
       
   639 	TDmaTransferArgs tferArgs(0, 1*size, size, KDmaMemAddr, KDmaSyncAuto, KDmaRequestCallbackFromIsr);
       
   640 
       
   641 	TIsrRequeArgs requeArgArray[] = {
       
   642 		TIsrRequeArgs(),									// Repeat
       
   643 		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
       
   644 		TIsrRequeArgs(),									// Repeat
       
   645 		TIsrRequeArgs(3*size, KPhysAddrInvalidUser, 0),		// Change source
       
   646 		TIsrRequeArgs(),									// Repeat
       
   647 	};
       
   648 	TIsrRequeArgsSet argSet(requeArgArray, ARRAY_LENGTH(requeArgArray));
       
   649 
       
   650 	test.Next(_L("Test that Substitute updates transfer args in order"));
       
   651 	argSet.Substitute(tferArgs);
       
   652 
       
   653 	TAddressParms expectedFinal(3*size, 2*size, size);
       
   654 	if(!(expectedFinal == argSet.iRequeArgs[4]))
       
   655 		{
       
   656 		TBuf<0x100> out;
       
   657 
       
   658 		out += _L("substitue: ");
       
   659 		GetAddrParms(tferArgs).AppendString(out);
       
   660 		test.Printf(out);
       
   661 
       
   662 		out.Zero();
       
   663 		out += _L("\nexpected final: ");
       
   664 		expectedFinal.AppendString(out);
       
   665 		test.Printf(out);
       
   666 
       
   667 		out.Zero();
       
   668 		out += _L("\nactual: ");
       
   669 		argSet.iRequeArgs[4].AppendString(out);
       
   670 		test.Printf(out);
       
   671 
       
   672 		test(EFalse);
       
   673 		}
       
   674 
       
   675 	TIsrRequeArgs requeArgArray2[] = {
       
   676 		TIsrRequeArgs(),									// Repeat
       
   677 		TIsrRequeArgs(KPhysAddrInvalidUser, 2*size, 0),		// Change destination
       
   678 		TIsrRequeArgs(KPhysAddrInvalidUser, 1*size, 0),		// Change destination back
       
   679 	};
       
   680 	argSet = TIsrRequeArgsSet(requeArgArray2, ARRAY_LENGTH(requeArgArray2));
       
   681 
       
   682 	test.Next(_L("CheckRange(), negative"));
       
   683 
       
   684 	test(!argSet.CheckRange(0, (2 * size) - 1, tferArgs));
       
   685 	test(!argSet.CheckRange(0, (2 * size) + 1, tferArgs));
       
   686 	test(!argSet.CheckRange(0, (2 * size), tferArgs));
       
   687 
       
   688 	test(!argSet.CheckRange(1 ,(3 * size), tferArgs));
       
   689 	test(!argSet.CheckRange(1 ,(3 * size) + 1, tferArgs));
       
   690 
       
   691 	test(!argSet.CheckRange(1 * size , 2 * size, tferArgs));
       
   692 
       
   693 	test.Next(_L("CheckRange(), positive"));
       
   694 	test(argSet.CheckRange(0, 3 * size, tferArgs));
       
   695 	test(argSet.CheckRange(0, 3 * size+1, tferArgs));
       
   696 	test(argSet.CheckRange(0, 4 * size, tferArgs));
       
   697 
       
   698 
       
   699 	test.End();
       
   700 	}
       
   701 
       
   702 void RArrayCopyTestL()
       
   703 	{
       
   704 	test.Start(_L("Selftest of RArray CopyL"));
       
   705 
       
   706 	RArray<TInt> orig;
       
   707 	TInt i;													// VC++
       
   708 	for(i=0; i<10; i++)
       
   709 		{
       
   710 		orig.AppendL(i);
       
   711 		}
       
   712 
       
   713 	RArray<TInt> newArray;
       
   714 	CopyL(orig, newArray);
       
   715 
       
   716 	test_Equal(10, newArray.Count());
       
   717 
       
   718 	for(i=0; i<10; i++)
       
   719 		{
       
   720 		test_Equal(orig[i], newArray[i])
       
   721 		}
       
   722 
       
   723 	orig.Close();
       
   724 	newArray.Close();
       
   725 	test.End();
       
   726 	}
       
   727 
       
   728 void RArrayInsertLTest()
       
   729 	{
       
   730 	test.Start(_L("Selftest of RArray InsertL"));
       
   731 
       
   732 	RArray<TInt> array;
       
   733 	TInt numbers[10] = {0,1,2,3,4,5,6,7,8,9};
       
   734 	ArrayAppendL(array, &numbers[0], numbers + ARRAY_LENGTH(numbers));
       
   735 
       
   736 	test_Equal(10, array.Count());
       
   737 	for(TInt i=0; i<10; i++)
       
   738 		{
       
   739 		test_Equal(numbers[i], array[i])
       
   740 		}
       
   741 
       
   742 	array.Close();
       
   743 	test.End();
       
   744 	}
       
   745 
       
   746 /**
       
   747 Run check buffers on the supplied TAddressParms array
       
   748 */
       
   749 TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive)
       
   750 	{
       
   751 	_LIT(KPositive, "positive");
       
   752 	_LIT(KNegative, "negative");
       
   753 	test.Printf(_L("CheckBuffers %S test: %d args, repeats allowed %d\n"),
       
   754 			(aPositive ? &KPositive : &KNegative), aCount, aAllowRepeat);
       
   755 	RArray<const TAddressParms> array;
       
   756 	ArrayAppendL(array, aParms, aParms + aCount);
       
   757 	TPreTransferIncrBytes preTran;
       
   758 	TBool r = preTran.CheckBuffers(array, aAllowRepeat);
       
   759 	array.Close();
       
   760 	return r;
       
   761 	}
       
   762 
       
   763 void TPreTransferIncrBytes::SelfTest()
       
   764 	{
       
   765 	// Test that TPreTransferIncrBytes::CheckBuffers can identify
       
   766 	// overlapping buffers
       
   767 	test.Start(_L("Selftest of TPreTransferIncrBytes"));
       
   768 
       
   769 // Macro generates test for 2 element array
       
   770 #define TPARM_TEST2(EXPECT, ALLOW_REPEAT, EL0, EL1)\
       
   771 		{\
       
   772 		TAddressParms set[2] = {EL0, EL1}; \
       
   773 		const TBool r = DoTferParmTestL(set, 2, ALLOW_REPEAT, EXPECT);\
       
   774 		test_Equal(EXPECT, r);\
       
   775 		}
       
   776 
       
   777 // Generate positive 2 element test
       
   778 #define TPARM_TEST2_POSITIVE(ALLOW_REPEAT, EL0, EL1) TPARM_TEST2(ETrue, ALLOW_REPEAT, EL0, EL1)
       
   779 // Generate negative 2 element test
       
   780 #define TPARM_TEST2_NEG(ALLOW_REPEAT, EL0, EL1) TPARM_TEST2(EFalse, ALLOW_REPEAT, EL0, EL1)
       
   781 
       
   782 // Macro generates test for 3 element array
       
   783 #define TPARM_TEST3(EXPECT, ALLOW_REPEAT, EL0, EL1, EL2)\
       
   784 		{\
       
   785 		TAddressParms set[3] = {EL0, EL1, EL2}; \
       
   786 		const TBool r = DoTferParmTestL(set, 3, ALLOW_REPEAT, EXPECT);\
       
   787 		test_Equal(EXPECT, r);\
       
   788 		}
       
   789 
       
   790 // Generate positive 3 element test
       
   791 #define TPARM_TEST3_POSITIVE(ALLOW_REPEAT, EL0, EL1, EL2) TPARM_TEST3(ETrue, ALLOW_REPEAT, EL0, EL1, EL2)
       
   792 // Generate negative 3 element test
       
   793 #define TPARM_TEST3_NEG(ALLOW_REPEAT, EL0, EL1, EL2) TPARM_TEST3(EFalse, ALLOW_REPEAT, EL0, EL1, EL2)
       
   794 
       
   795 	TPARM_TEST2_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(32, 48, 16));
       
   796 	TPARM_TEST2_POSITIVE(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // both overlap (repeat allowed)
       
   797 
       
   798 	TPARM_TEST2_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(24, 40, 16)); // second source depends on first destination
       
   799 	TPARM_TEST2_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(16, 0, 16)); // second dest overwrites first source
       
   800 	TPARM_TEST2_NEG(EFalse, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // both overlap (repeat not allowed)
       
   801 	TPARM_TEST2_NEG(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 20, 16)); // exact repeat allowed, but overlap is only partial
       
   802 	TPARM_TEST2_NEG(ETrue, TAddressParms(0, 16, 16), TAddressParms(32, 16, 16)); // exact repeat allowed, but 2nd overwrites first dest
       
   803 
       
   804 
       
   805 	TPARM_TEST3_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(32, 48, 16), TAddressParms(64, 128, 64)); // no overlaps
       
   806 	TPARM_TEST3_POSITIVE(ETrue, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // all overlap (repeat allowed)
       
   807 	TPARM_TEST3_POSITIVE(EFalse, TAddressParms(0,16,16), TAddressParms(0, 32, 16), TAddressParms(0, 48, 16)); // no overlaps (1 src to 3 dsts)
       
   808 
       
   809 	TPARM_TEST3_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(128, 256, 128), TAddressParms(24, 40, 16)); // 3rd source depends on first destination
       
   810 	TPARM_TEST3_NEG(EFalse, TAddressParms(0,16,16), TAddressParms(128, 256, 128), TAddressParms(16, 0, 16)); // 3rd dest overwrites first source
       
   811 	TPARM_TEST3_NEG(EFalse, TAddressParms(0, 16, 16), TAddressParms(0, 16, 16), TAddressParms(0, 16, 16)); // all overlap (repeat not allowed)
       
   812 	test.Next(_L("CheckBuffers(RArray<TAddressParms>)"));
   650 	}
   813 	}
   651 
   814 
   652 void SelfTests()
   815 void SelfTests()
   653 	{
   816 	{
   654 	test.Next(_L("Running framework unit tests"));
   817 	test.Next(_L("Running framework unit tests"));
   658 	TTransferIter::SelfTest();
   821 	TTransferIter::SelfTest();
   659 	TCallbackRecord::SelfTest();
   822 	TCallbackRecord::SelfTest();
   660 	CDmaBmFragmentation::SelfTest();
   823 	CDmaBmFragmentation::SelfTest();
   661 	TAddrRange::SelfTest();
   824 	TAddrRange::SelfTest();
   662 	TAddressParms::SelfTest();
   825 	TAddressParms::SelfTest();
       
   826 	TIsrRequeArgsSet::SelfTest();
       
   827 	RArrayCopyTestL();
       
   828 	RArrayInsertLTest();
       
   829 	TPreTransferIncrBytes::SelfTest();
   663 	test.End();
   830 	test.End();
   664 	test.Close();
   831 	test.Close();
   665 	}
   832 	}