0
|
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 CTEFClientUT.cpp
|
|
22 |
*/
|
|
23 |
|
|
24 |
#include "ctefactivefixtureut.h"
|
|
25 |
#include <TEFExportConst.h>
|
|
26 |
void CTEFActiveFixtureUT::SetupL()
|
|
27 |
/**
|
|
28 |
* SetupL
|
|
29 |
*/
|
|
30 |
{
|
|
31 |
CActiveTestFixture::SetupL();
|
|
32 |
}
|
|
33 |
|
|
34 |
void CTEFActiveFixtureUT::TearDownL()
|
|
35 |
/**
|
|
36 |
* TearDownL
|
|
37 |
*/
|
|
38 |
{
|
|
39 |
CActiveTestFixture::TearDownL();
|
|
40 |
}
|
|
41 |
|
|
42 |
void CTEFActiveFixtureUT::TestCTestConfig()
|
|
43 |
{
|
|
44 |
TInt theInt = 10;
|
|
45 |
|
|
46 |
TBool res = iConfig.GetInt(_L("Int"),theInt);
|
|
47 |
ASSERT_TRUE(res);
|
|
48 |
ASSERT_TRUE(theInt == 10);
|
|
49 |
|
|
50 |
TBool theBool = false;
|
|
51 |
res = iConfig.WriteBool(_L("BoolFalse"),theBool);
|
|
52 |
ASSERT_TRUE(res);
|
|
53 |
|
|
54 |
res = iConfig.GetBool(_L("BoolFalse"),theBool);
|
|
55 |
ASSERT_TRUE(res);
|
|
56 |
ASSERT_TRUE(theBool == false);
|
|
57 |
|
|
58 |
res = iConfig.GetBool(_L("BoolTrue"),theBool);
|
|
59 |
ASSERT_TRUE(res);
|
|
60 |
ASSERT_TRUE(theBool == true);
|
|
61 |
|
|
62 |
theInt = 0xff;
|
|
63 |
res = iConfig.WriteHex(_L("Hex"),theInt);
|
|
64 |
ASSERT_TRUE(res);
|
|
65 |
|
|
66 |
res = iConfig.GetHex(_L("Hex"),theInt);
|
|
67 |
ASSERT_TRUE(res);
|
|
68 |
ASSERT_TRUE(theInt == 0xff);
|
|
69 |
|
|
70 |
_LIT(KTestString,"To Be A Drummer! # comments");
|
|
71 |
TPtrC theString(KTestString);
|
|
72 |
|
|
73 |
res = iConfig.WriteString(_L("String"),theString);
|
|
74 |
ASSERT_TRUE(res);
|
|
75 |
|
|
76 |
res = iConfig.GetString(_L("String"),theString);
|
|
77 |
ASSERT_TRUE(res);
|
|
78 |
ASSERT_FALSE(theString.Compare(KTestString) );
|
|
79 |
|
|
80 |
test_Int64_Step_Suite();
|
|
81 |
}
|
|
82 |
void CTEFActiveFixtureUT::test_Int64_Step_Suite()
|
|
83 |
{
|
|
84 |
test_TInt64_STEP(0); //<32 bit
|
|
85 |
test_TInt64_STEP(31); //<32 bit
|
|
86 |
test_TInt64_STEP(32); //<32 bit
|
|
87 |
test_TInt64_STEP(33); //<64 bit
|
|
88 |
test_TInt64_STEP(63); //<64 bit
|
|
89 |
test_TInt64_STEP(64); //<64 bit
|
|
90 |
}
|
|
91 |
void CTEFActiveFixtureUT::test_TInt64_STEP(TInt aShift)
|
|
92 |
{
|
|
93 |
TInt64 TheInt64,tmp;
|
|
94 |
TheInt64 = (TInt64)1<<aShift ;
|
|
95 |
iConfig.WriteInt(_L("TheInt64"),TheInt64);
|
|
96 |
(void)iConfig.GetInt(_L("TheInt64"),tmp);
|
|
97 |
ASSERT(tmp==TheInt64);
|
|
98 |
}
|
|
99 |
void CTEFActiveFixtureUT::TestCTestConfig_Negtive()
|
|
100 |
{
|
|
101 |
TInt theInt = 10;
|
|
102 |
|
|
103 |
iConfig.WriteInt(_L("Int"),theInt);
|
|
104 |
|
|
105 |
(void)iConfig.GetInt(_L("Int"),theInt);
|
|
106 |
|
|
107 |
TBool theBool = false;
|
|
108 |
(void)iConfig.WriteBool(_L("BoolFalse"),theBool);
|
|
109 |
|
|
110 |
(void)iConfig.GetBool(_L("BoolFalse"),theBool);
|
|
111 |
|
|
112 |
(void)iConfig.GetBool(_L("BoolTrue"),theBool);
|
|
113 |
|
|
114 |
theInt = 0xff;
|
|
115 |
(void)iConfig.WriteHex(_L("Hex"),theInt);
|
|
116 |
|
|
117 |
(void)iConfig.GetHex(_L("Hex"),theInt);
|
|
118 |
_LIT(KTestString,"To Be A Drummer! # comments");
|
|
119 |
TPtrC theString(KTestString);
|
|
120 |
|
|
121 |
(void)iConfig.WriteString(_L("String"),theString);
|
|
122 |
|
|
123 |
TBool res = iConfig.GetString(_L("String"),theString);
|
|
124 |
|
|
125 |
ASSERT_TRUE(res);
|
|
126 |
}
|
|
127 |
void CTEFActiveFixtureUT::TestUnitTimeout()
|
|
128 |
{
|
|
129 |
User::After(1*1000);
|
|
130 |
}
|
|
131 |
void CTEFActiveFixtureUT::TestUnitTimeout_Negtive()
|
|
132 |
{
|
|
133 |
User::After(1000*1000*1000);
|
|
134 |
}
|
|
135 |
void CTEFActiveFixtureUT::TestUnitLogger()
|
|
136 |
{
|
|
137 |
INFO_PRINTF1(_L("TEFUnit logging information!") );
|
|
138 |
}
|
|
139 |
|
|
140 |
CTestSuite* CTEFActiveFixtureUT::CreateSuiteL(const TDesC& aName)
|
|
141 |
/**
|
|
142 |
* CreateSuiteL
|
|
143 |
*
|
|
144 |
* @param aName - Suite name
|
|
145 |
* @return - Suite
|
|
146 |
*/
|
|
147 |
{
|
|
148 |
SUB_SUITE
|
|
149 |
ADD_ASYNC_TEST_STEP_CLASS( CTEFActiveFixtureUT,TestCTestConfig)
|
|
150 |
ADD_ASYNC_TEST_STEP_CLASS( CTEFActiveFixtureUT,TestCTestConfig_Negtive)
|
|
151 |
ADD_ASYNC_TEST_STEP_CLASS( CTEFActiveFixtureUT,TestUnitTimeout)
|
|
152 |
ADD_ASYNC_TEST_STEP_CLASS( CTEFActiveFixtureUT,TestUnitLogger)
|
|
153 |
ADD_ASYNC_TEST_STEP_CLASS( CTEFActiveFixtureUT,TestUnitTimeout_Negtive)
|
|
154 |
END_SUITE
|
|
155 |
}
|