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 ************************************************************************/
29 #include <cosv/string.hxx>
31 // NOT FULLY DECLARED SERVICES
34 using csv::SimpleString
;
38 UnitTests for class String.
42 check_value( const String
& a
, const char * b
)
44 return strcmp( a
.c_str(), b
) == 0;
49 classtest_String( csv::SimpleString
& rSimpleString
)
54 UT_CHECK( String(), check_value(x1
,"") )
56 const char * s2a
= "";
58 UT_CHECK( String(const char*), check_value(x2a
,s2a
) )
60 const char * s2b
= "_zluoadninger prrg chiäßi(/%$##@\\\"'''fh kl";
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();
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
)
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
);
102 FUT_DECL( SimpleString
, Write
)
111 FUT_DECL( SimpleString
, Seek
)
120 FUT_DECL( SimpleString
, SeekBack
)
129 FUT_DECL( SimpleString
, SeekRelative
)