First public contribution.
2 * Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 #include "t_rfc1642.h"
22 ///////////////////////////////////////////////////////////////////////////////////////
27 ERR_PRINTF1(_L("ERROR: Test Failed")); \
31 ///////////////////////////////////////////////////////////////////////////////////////
32 ///////////////////////////////////////////////////////////////////////////////////////
34 @SYMTestCaseID SYSLIB-CHARCONV-CT-0564
35 @SYMTestCaseDesc Tests for conversion from UTF-7 to Unicode character set
36 @SYMTestPriority Medium
37 @SYMTestActions Tests for CnvUtfConverter::ConvertToUnicodeFromUtf7() function
38 @SYMTestExpectedResults Test must not fail
41 void CT_RFC1642::TestRFC1642()
44 INFO_PRINTF1(_L(" @SYMTestCaseID:SYSLIB-CHARCONV-CT-0564 Testing the examples given in RFC 1642 "));
45 TBuf16<256> generatedUnicode;
46 TInt state=CnvUtfConverter::KStateDefault;
48 INFO_PRINTF1(_L("Empty descriptor"));
49 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8(""), state)==0);
50 test(state==CnvUtfConverter::KStateDefault);
51 test(generatedUnicode==_L16(""));
52 INFO_PRINTF1(_L("\"A<NOT IDENTICAL TO><ALPHA>.\""));
53 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8("A+ImIDkQ."), state)==0);
54 test(state==CnvUtfConverter::KStateDefault);
55 test(generatedUnicode.Length()==4);
56 test(generatedUnicode[0]==0x0041);
57 test(generatedUnicode[1]==0x2262);
58 test(generatedUnicode[2]==0x0391);
59 test(generatedUnicode[3]==0x002e);
60 INFO_PRINTF1(_L("\"Hi Mom <WHITE SMILING FACE>!\""));
61 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8("Hi Mom +Jjo-!"), state)==0);
62 test(state==CnvUtfConverter::KStateDefault);
63 test(generatedUnicode.Length()==9);
64 test(generatedUnicode[0]==0x0048);
65 test(generatedUnicode[1]==0x0069);
66 test(generatedUnicode[2]==0x0020);
67 test(generatedUnicode[3]==0x004d);
68 test(generatedUnicode[4]==0x006f);
69 test(generatedUnicode[5]==0x006d);
70 test(generatedUnicode[6]==0x0020);
71 test(generatedUnicode[7]==0x263a);
72 test(generatedUnicode[8]==0x0021);
73 INFO_PRINTF1(_L("The japanese word \"nihongo\""));
74 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8("+ZeVnLIqe-"), state)==0);
75 test(state==CnvUtfConverter::KStateDefault);
76 test(generatedUnicode.Length()==3);
77 test(generatedUnicode[0]==0x65e5);
78 test(generatedUnicode[1]==0x672c);
79 test(generatedUnicode[2]==0x8a9e);
80 INFO_PRINTF1(_L("The special case of \"+-\""));
81 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8("+-"), state)==0);
82 test(state==CnvUtfConverter::KStateDefault);
83 test(generatedUnicode==_L16("+"));
84 INFO_PRINTF1(_L("The special case of \"+-\" in a context"));
85 test(CnvUtfConverter::ConvertToUnicodeFromUtf7(generatedUnicode, _L8("2+-3 is 5"), state)==0);
86 test(state==CnvUtfConverter::KStateDefault);
87 test(generatedUnicode==_L16("2+3 is 5"));
92 CT_RFC1642::CT_RFC1642()
94 SetTestStepName(KTestStep_T_RFC1642);
97 TVerdict CT_RFC1642::doTestStepL()
99 SetTestStepResult(EFail);
103 TRAPD(error1, TestRFC1642());
107 if(error1 == KErrNone )
109 SetTestStepResult(EPass);
112 return TestStepResult();