lowlevellibsandfws/apputils/tsrc/T_PTRCB.CPP
author Shabe Razvi <shaber@symbian.org>
Tue, 29 Jun 2010 11:29:33 +0100
branchRCL_3
changeset 40 ddd39d92c350
parent 0 e4d67989cc36
permissions -rw-r--r--
Bug 3123 - libstdcppv5.dll fails to link due to missing symbols

// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// Tests for CPtrC8Array and TKeyDesC8Array class(Test Improvement activity)
// 
//

#include <e32test.h>
#include <badesca.h>

RTest test(_L("T_PTRCB"));

/**
@SYMTestCaseID          SYSLIB-BAFL-UT-1706
@SYMTestCaseDesc        Testing 8-bit descriptor arrays
						Tests for CPtrC8Array::MdcaCount(),CPtrC8Array::CopyL(),CPtrC8Array::operator =() functions
@SYMTestPriority        Medium
@SYMTestActions         Tests by adding descriptors to CDesC8Array and then copying to CPtrC8Array
@SYMTestExpectedResults Tests must not fail
@SYMREQ                 REQ0000
*/

void DoTestsL()
	{
	test.Next(_L("Test for ptrC8 and desC8 arrays"));

	CPtrC8Array* ptrB = new(ELeave) CPtrC8Array(8);
	CDesC8Array* desB = new(ELeave) CDesC8ArrayFlat(8);

	desB->AppendL(_L8("one"));
	desB->AppendL(_L8("two"));
	desB->AppendL(_L8("three"));

	// calling CPtrC8Array::CopyL() with an overloaded '=' operator

	*ptrB = *desB;

	test(ptrB->MdcaCount()==desB->MdcaCount());
	test(ptrB->MdcaPoint(2)==desB->MdcaPoint(2));

	test.Next(_L("Test for covering case ECmpCollated8 for TKeyDesC8Array class"));

	TInt pos = desB->InsertIsqAllowDuplicatesL(_L8("hello"));
	test(desB->MdcaCount()==4);

	// Invoking TKeyDesC8Array::Compare(), covers ECmpCollated8 case inside switch statement

	desB->Sort(ECmpCollated8);

	delete(ptrB);
	delete(desB);
	}


TInt E32Main()
	{
    __UHEAP_MARK;

    CTrapCleanup* cleanup=CTrapCleanup::New();
	if(cleanup == NULL)
	{
		return KErrNoMemory;
	}
	test.Title();
	test.Start(_L(" @SYMTestCaseID:SYSLIB-BAFL-UT-1706 Testing CPtrC8Array and TKeyDesC8Array class "));

    TRAPD(err,DoTestsL());
    test(err==KErrNone);
    test.End();
    test.Close();
    delete cleanup;

    __UHEAP_MARKEND;

	return(0);
    }