|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file CTestAsyncSuiteA.cpp |
|
22 */ |
|
23 |
|
24 #include "CTestAsyncSuiteA.h" |
|
25 |
|
26 void CTestAsyncSuiteA::SetupL() |
|
27 /** |
|
28 * SetupL |
|
29 */ |
|
30 { |
|
31 } |
|
32 |
|
33 void CTestAsyncSuiteA::TearDownL() |
|
34 /** |
|
35 * TearDownL |
|
36 */ |
|
37 { |
|
38 } |
|
39 |
|
40 void CTestAsyncSuiteA::TestOne() |
|
41 /** |
|
42 * TestOne |
|
43 */ |
|
44 { |
|
45 INFO_PRINTF1(_L("Running AsyncSuiteA:One")); |
|
46 TInt theInt = 0; |
|
47 TBool res = iConfig.GetInt(_L("TheInt"),theInt); |
|
48 ASSERT_TRUE(res); |
|
49 |
|
50 TBool theBool = EFalse; |
|
51 res = iConfig.GetBool(_L("TheBool"), theBool); |
|
52 ASSERT_TRUE(res); |
|
53 |
|
54 // Test all the Logging functions |
|
55 INFO_PRINTF1(_L("Info Print Tests")); |
|
56 INFO_PRINTF2(_L("Int = %d"),theInt); |
|
57 INFO_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool); |
|
58 INFO_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt); |
|
59 INFO_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool); |
|
60 INFO_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt); |
|
61 INFO_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool); |
|
62 |
|
63 WARN_PRINTF1(_L("Warn Print Tests")); |
|
64 WARN_PRINTF2(_L("Int = %d"),theInt); |
|
65 WARN_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool); |
|
66 WARN_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt); |
|
67 WARN_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool); |
|
68 WARN_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt); |
|
69 WARN_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool); |
|
70 |
|
71 ERR_PRINTF1(_L("Err Print Tests")); |
|
72 ERR_PRINTF2(_L("Int = %d"),theInt); |
|
73 ERR_PRINTF3(_L("Int = %d Bool = %d"),theInt,theBool); |
|
74 ERR_PRINTF4(_L("Int = %d Bool = %d Int = %d"),theInt,theBool,theInt); |
|
75 ERR_PRINTF5(_L("Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt, theBool); |
|
76 ERR_PRINTF6(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d"),theInt,theBool,theInt,theBool,theInt); |
|
77 ERR_PRINTF7(_L("Int = %d Bool = %d Int = %d Bool = %d Int = %d Bool = %d"),theInt,theBool,theInt,theBool, theInt, theBool); |
|
78 } |
|
79 |
|
80 void CTestAsyncSuiteA::TestTwo() |
|
81 /** |
|
82 * TestTwo |
|
83 */ |
|
84 { |
|
85 INFO_PRINTF1(_L("Running AsyncSuiteA:Two")); |
|
86 |
|
87 // Test all the configuration info is retrieved correctly from SectionOne |
|
88 TInt theInt = 0; |
|
89 TBool res = iConfig.GetInt(_L("SectionOne"),_L("TheInt"),theInt); |
|
90 ASSERT_TRUE(res); |
|
91 ASSERT_EQUALS( theInt, 999 ); |
|
92 |
|
93 TBool theBool = EFalse; |
|
94 res = iConfig.GetBool(_L("SectionOne"),_L("TheBool"), theBool); |
|
95 ASSERT_TRUE(res); |
|
96 ASSERT_TRUE( theBool ); |
|
97 |
|
98 TInt theHex = 0; |
|
99 res = iConfig.GetHex(_L("SectionOne"), _L("TheHex"), theHex); |
|
100 ASSERT_TRUE(res); |
|
101 ASSERT_EQUALS( theHex, (TInt)0x12345678 ); |
|
102 |
|
103 TPtrC theString; |
|
104 res = iConfig.GetString(_L("SectionOne"), _L("TheString"), theString); |
|
105 ASSERT_TRUE(res); |
|
106 ASSERT_EQUALS( theString, _L("TheString") ); |
|
107 |
|
108 // Test all the configuration info is retrieved correctly from SectionTwo |
|
109 res = iConfig.GetInt(_L("SectionTwo"),_L("TheInt"),theInt); |
|
110 ASSERT_TRUE(res); |
|
111 ASSERT_EQUALS( theInt, 666 ); |
|
112 |
|
113 res = iConfig.GetBool(_L("SectionTwo"),_L("TheBool"), theBool); |
|
114 ASSERT_TRUE(res); |
|
115 ASSERT_FALSE( theBool ); |
|
116 |
|
117 res = iConfig.GetHex(_L("SectionTwo"), _L("TheHex"), theHex); |
|
118 ASSERT_TRUE(res); |
|
119 ASSERT_EQUALS( theHex, (TInt)0x87654321 ); |
|
120 |
|
121 res = iConfig.GetString(_L("SectionTwo"), _L("TheString"), theString); |
|
122 ASSERT_TRUE(res); |
|
123 ASSERT_EQUALS( theString, _L("TheStringReturns") ); |
|
124 |
|
125 // Test all the asserts work |
|
126 TInt a = 5; |
|
127 TInt b = 5; |
|
128 ASSERT_EQUALS(a, b); |
|
129 |
|
130 CTestConfig* aPtr = NULL; |
|
131 ASSERT_NULL( aPtr ); |
|
132 |
|
133 aPtr = &iConfig; |
|
134 ASSERT_NOT_NULL( aPtr ); |
|
135 |
|
136 ASSERT_SAME( aPtr, &iConfig ); |
|
137 |
|
138 aPtr = NULL; |
|
139 ASSERT_NOT_SAME( aPtr, &iConfig ); |
|
140 |
|
141 TBool aBool = ETrue; |
|
142 ASSERT_TRUE(aBool); |
|
143 ASSERT_FALSE(!aBool); |
|
144 } |
|
145 |
|
146 CTestSuite* CTestAsyncSuiteA::CreateSuiteL( const TDesC& aName ) |
|
147 /** |
|
148 * CreateSuiteL |
|
149 * |
|
150 * @param aName - Suite name |
|
151 * @return - Suite |
|
152 */ |
|
153 { |
|
154 SUB_SUITE; |
|
155 #ifndef __GCCXML__ |
|
156 ADD_ASYNC_TEST_STEP( TestOne ); |
|
157 ADD_ASYNC_TEST_STEP( TestTwo ); |
|
158 #endif |
|
159 #ifdef __GCCXML__ |
|
160 ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteA, TestOne ); |
|
161 ADD_ASYNC_TEST_STEP_CLASS( CTestAsyncSuiteA, TestTwo ); |
|
162 #endif |
|
163 END_SUITE; |
|
164 } |