1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 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. 14 * 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). 20 * 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. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include <cosv/string.hxx> 30 31 // NOT FULLY DECLARED SERVICES 32 #include <ut.hxx> 33 34 using csv::SimpleString; 35 36 37 /** @file 38 UnitTests for class String. 39 */ 40 41 inline bool 42 check_value( const String & a, const char * b ) 43 { 44 return strcmp( a.c_str(), b ) == 0; 45 } 46 47 48 bool 49 classtest_String( csv::SimpleString & rSimpleString ) 50 { 51 bool ret = true; 52 53 String x1; 54 UT_CHECK( String(), check_value(x1,"") ) 55 56 const char * s2a = ""; 57 String x2a(s2a); 58 UT_CHECK( String(const char*), check_value(x2a,s2a) ) 59 60 const char * s2b = "_zluoadninger prrg chi��i(/%$##@\\\"'''fh kl"; 61 String x2b(s2b); 62 UT_CHECK( String(const char*), check_value(x2b,s2b) ) 63 64 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; 69 70 rSimpleString.Close(); 71 72 return ret; 73 } 74 75 76 77 78 #if 0 79 FUT_DECL( SimpleString, Ctor_Def ); 80 FUT_DECL( SimpleString, Seek ); 81 FUT_DECL( SimpleString, SeekBack ); 82 FUT_DECL( SimpleString, SeekRelative ); 83 84 85 86 FUT_DECL( SimpleString, Read ) 87 { 88 bool ret = true; 89 90 rSimpleString.SeekBack(0); 91 uintt nSourceSize = rSimpleString.Position(); 92 rSimpleString.Seek(0); 93 94 char * pBuf = new char[nSourceSize+1]; 95 uintt nCount = rSimpleString.Read(pBuf,nSourceSize); 96 97 UT_CHECK( Read, nCount == nSourceSize ); 98 99 return ret; 100 } 101 102 FUT_DECL( SimpleString, Write ) 103 { 104 bool ret = true; 105 106 107 108 return ret; 109 } 110 111 FUT_DECL( SimpleString, Seek ) 112 { 113 bool ret = true; 114 115 116 117 return ret; 118 } 119 120 FUT_DECL( SimpleString, SeekBack ) 121 { 122 bool ret = true; 123 124 125 126 return ret; 127 } 128 129 FUT_DECL( SimpleString, SeekRelative ) 130 { 131 bool ret = true; 132 133 134 135 return ret; 136 } 137 138 #endif 139 140 141