merged tag ooo/OOO330_m14
[LibreOffice.git] / cosv / source / unittest / string_ut.cxx
blob690950d8ee974c0d58f1c99e431f81d72b4ef3da
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include <precomp.h>
29 #include <cosv/string.hxx>
31 // NOT FULLY DECLARED SERVICES
32 #include <ut.hxx>
34 using csv::SimpleString;
37 /** @file
38 UnitTests for class String.
41 inline bool
42 check_value( const String & a, const char * b )
44 return strcmp( a.c_str(), b ) == 0;
48 bool
49 classtest_String( csv::SimpleString & rSimpleString )
51 bool ret = true;
53 String x1;
54 UT_CHECK( String(), check_value(x1,"") )
56 const char * s2a = "";
57 String x2a(s2a);
58 UT_CHECK( String(const char*), check_value(x2a,s2a) )
60 const char * s2b = "_zluoadninger prrg chiäßi(/%$##@\\\"'''fh kl";
61 String x2b(s2b);
62 UT_CHECK( String(const char*), check_value(x2b,s2b) )
65 bool ret = ftest_Read( rSimpleString );
66 ret = ftest_Write( rSimpleString ) AND ret;
67 ret = ftest_SeekBack( rSimpleString ) AND ret;
68 ret = ftest_SeekRelative( rSimpleString ) AND ret;
70 rSimpleString.Close();
72 return ret;
78 #if 0
79 FUT_DECL( SimpleString, Ctor_Def );
80 FUT_DECL( SimpleString, Seek );
81 FUT_DECL( SimpleString, SeekBack );
82 FUT_DECL( SimpleString, SeekRelative );
86 FUT_DECL( SimpleString, Read )
88 bool ret = true;
90 rSimpleString.SeekBack(0);
91 uintt nSourceSize = rSimpleString.Position();
92 rSimpleString.Seek(0);
94 char * pBuf = new char[nSourceSize+1];
95 uintt nCount = rSimpleString.Read(pBuf,nSourceSize);
97 UT_CHECK( Read, nCount == nSourceSize );
99 return ret;
102 FUT_DECL( SimpleString, Write )
104 bool ret = true;
108 return ret;
111 FUT_DECL( SimpleString, Seek )
113 bool ret = true;
117 return ret;
120 FUT_DECL( SimpleString, SeekBack )
122 bool ret = true;
126 return ret;
129 FUT_DECL( SimpleString, SeekRelative )
131 bool ret = true;
135 return ret;
138 #endif