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