159617ebcSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
359617ebcSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
459617ebcSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
559617ebcSAndrew Rist  * distributed with this work for additional information
659617ebcSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
759617ebcSAndrew Rist  * to you under the Apache License, Version 2.0 (the
859617ebcSAndrew Rist  * "License"); you may not use this file except in compliance
959617ebcSAndrew Rist  * with the License.  You may obtain a copy of the License at
1059617ebcSAndrew Rist  *
1159617ebcSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1259617ebcSAndrew Rist  *
1359617ebcSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1459617ebcSAndrew Rist  * software distributed under the License is distributed on an
1559617ebcSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1659617ebcSAndrew Rist  * KIND, either express or implied.  See the License for the
1759617ebcSAndrew Rist  * specific language governing permissions and limitations
1859617ebcSAndrew Rist  * under the License.
1959617ebcSAndrew Rist  *
2059617ebcSAndrew Rist  *************************************************************/
2159617ebcSAndrew Rist 
2259617ebcSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include <precomp.h>
25cdf0e10cSrcweir #include <cosv/string.hxx>
26cdf0e10cSrcweir 
27cdf0e10cSrcweir // NOT FULLY DECLARED SERVICES
28cdf0e10cSrcweir #include <ut.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir using csv::SimpleString;
31cdf0e10cSrcweir 
32cdf0e10cSrcweir 
33cdf0e10cSrcweir /** @file
34cdf0e10cSrcweir     UnitTests for class String.
35cdf0e10cSrcweir */
36cdf0e10cSrcweir 
37cdf0e10cSrcweir inline bool
check_value(const String & a,const char * b)38cdf0e10cSrcweir check_value( const String & a, const char * b )
39cdf0e10cSrcweir {
40cdf0e10cSrcweir  	return strcmp( a.c_str(), b ) == 0;
41cdf0e10cSrcweir }
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir bool
classtest_String(csv::SimpleString & rSimpleString)45cdf0e10cSrcweir classtest_String( csv::SimpleString & rSimpleString )
46cdf0e10cSrcweir {
47cdf0e10cSrcweir     bool ret = true;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir     String x1;
50cdf0e10cSrcweir     UT_CHECK( String(), check_value(x1,"") )
51cdf0e10cSrcweir 
52cdf0e10cSrcweir     const char * s2a = "";
53cdf0e10cSrcweir     String x2a(s2a);
54cdf0e10cSrcweir     UT_CHECK( String(const char*), check_value(x2a,s2a) )
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     const char * s2b = "_zluoadninger  prrg chi��i(/%$##@\\\"'''fh  kl";
57cdf0e10cSrcweir     String x2b(s2b);
58cdf0e10cSrcweir     UT_CHECK( String(const char*), check_value(x2b,s2b) )
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     bool ret = ftest_Read( rSimpleString );
62cdf0e10cSrcweir     ret = ftest_Write( rSimpleString ) AND ret;
63cdf0e10cSrcweir     ret = ftest_SeekBack( rSimpleString ) AND ret;
64cdf0e10cSrcweir     ret = ftest_SeekRelative( rSimpleString ) AND ret;
65cdf0e10cSrcweir 
66cdf0e10cSrcweir     rSimpleString.Close();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     return ret;
69cdf0e10cSrcweir }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 
73cdf0e10cSrcweir 
74cdf0e10cSrcweir #if 0
75cdf0e10cSrcweir FUT_DECL( SimpleString, Ctor_Def );
76cdf0e10cSrcweir FUT_DECL( SimpleString, Seek );
77cdf0e10cSrcweir FUT_DECL( SimpleString, SeekBack );
78cdf0e10cSrcweir FUT_DECL( SimpleString, SeekRelative );
79cdf0e10cSrcweir 
80cdf0e10cSrcweir 
81cdf0e10cSrcweir 
82cdf0e10cSrcweir FUT_DECL( SimpleString, Read )
83cdf0e10cSrcweir {
84cdf0e10cSrcweir     bool ret = true;
85cdf0e10cSrcweir 
86cdf0e10cSrcweir 	rSimpleString.SeekBack(0);
87cdf0e10cSrcweir 	uintt nSourceSize = rSimpleString.Position();
88cdf0e10cSrcweir 	rSimpleString.Seek(0);
89cdf0e10cSrcweir 
90cdf0e10cSrcweir     char * pBuf = new char[nSourceSize+1];
91cdf0e10cSrcweir 	uintt nCount = rSimpleString.Read(pBuf,nSourceSize);
92cdf0e10cSrcweir 
93cdf0e10cSrcweir     UT_CHECK( Read, nCount == nSourceSize );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir     return ret;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
98cdf0e10cSrcweir FUT_DECL( SimpleString, Write )
99cdf0e10cSrcweir {
100cdf0e10cSrcweir     bool ret = true;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 
103cdf0e10cSrcweir 
104cdf0e10cSrcweir     return ret;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir FUT_DECL( SimpleString, Seek )
108cdf0e10cSrcweir {
109cdf0e10cSrcweir     bool ret = true;
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 
112cdf0e10cSrcweir 
113cdf0e10cSrcweir     return ret;
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir FUT_DECL( SimpleString, SeekBack )
117cdf0e10cSrcweir {
118cdf0e10cSrcweir     bool ret = true;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     return ret;
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir FUT_DECL( SimpleString, SeekRelative )
126cdf0e10cSrcweir {
127cdf0e10cSrcweir     bool ret = true;
128cdf0e10cSrcweir 
129cdf0e10cSrcweir 
130cdf0e10cSrcweir 
131cdf0e10cSrcweir     return ret;
132cdf0e10cSrcweir }
133cdf0e10cSrcweir 
134cdf0e10cSrcweir #endif
135cdf0e10cSrcweir 
136cdf0e10cSrcweir 
137