Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\system\t_reg.cpp
16 // Test the machine configuration functions
18 // User::MachineConfiguration, User::SetMachineConfiguration
20 // - Save machine configuration to different size descriptors and verify
21 // the results are as expected.
22 // - Set the machine configuration back to previous configurations, verify
23 // the results are as expected.
24 // Platforms/Drives/Compatibility:
26 // Assumptions/Requirement/Pre-requisites:
27 // Failures and causes:
28 // Base Port information:
35 LOCAL_D RTest test(_L("T_REG"));
38 LOCAL_C void testMachineConfiguration()
40 // Test the machine configuration functions
44 test.Start(_L("Create test environment"));
46 test.Next(_L("Save machine configuration to tiny descriptor"));
48 TPtr8 mc11((TUint8*)&x,sizeof(x));
49 test(User::MachineConfiguration(mc11,x)==KErrArgument);
53 test.Next(_L("Save machine configuration to just too small descriptor"));
54 TUint8* pMC1=(TUint8*)User::Alloc(x);
58 test(User::MachineConfiguration(mc12,y)==KErrArgument);
61 test.Next(_L("Save machine configuration properly"));
63 test(User::MachineConfiguration(mc13,y)==KErrNone);
66 test.Next(_L("Save machine configuration to tiny descriptor"));
68 TPtr8 mc21((TUint8*)&z,sizeof(z));
69 test(User::MachineConfiguration(mc21,z)==KErrArgument);
73 test.Next(_L("Save machine configuration to just too small descriptor"));
74 TUint8* pMC2=(TUint8*)User::Alloc(z);
77 test(User::MachineConfiguration(mc22,y)==KErrArgument);
80 test.Next(_L("Save machine configuration properly"));
82 test(User::MachineConfiguration(mc23,y)==KErrNone);
85 // __KHEAP_MARK; // GLD 3/2/97 I don't know why the KHEAP checking is no longer working
86 test.Next(_L("Restore first configuration"));
87 test(User::SetMachineConfiguration(TPtrC8(pMC1,x))==KErrNone);
90 test.Next(_L("Restore second configuration"));
91 test(User::SetMachineConfiguration(TPtrC8(pMC2,z))==KErrNone);
94 test.Next(_L("Tidy up"));
101 GLDEF_C TInt E32Main()
103 // Test the registry functions.
109 test.Start(_L("Test Machine Configuration"));
110 testMachineConfiguration();