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/file.hxx> 26 27 // NOT FULLY DECLARED SERVICES 28 #include <ut.hxx> 29 30 using csv::File; 31 32 33 /** @file 34 UnitTests for class File. 35 */ 36 37 FUT_DECL( File, Read ); 38 FUT_DECL( File, Write ); 39 FUT_DECL( File, Seek ); 40 FUT_DECL( File, SeekBack ); 41 FUT_DECL( File, SeekRelative ); 42 43 44 bool 45 classtest_File() 46 { 47 csv::File aFile( "bigfile.txt", csv::CFM_RW, 0 ); 48 csv::File & rFile = aFile; 49 50 rFile.Open(); 51 52 bool ret = ftest_Read( rFile ); 53 ret = ftest_Write( rFile ) AND ret; 54 ret = ftest_SeekBack( rFile ) AND ret; 55 ret = ftest_SeekRelative( rFile ) AND ret; 56 57 rFile.Close(); 58 59 return ret; 60 } 61 62 63 64 FUT_DECL( File, Read ) 65 { 66 bool ret = true; 67 68 rFile.SeekBack(0); 69 uintt nSourceSize = rFile.Position(); 70 rFile.Seek(0); 71 72 char * pBuf = new char[nSourceSize+1]; 73 uintt nCount = rFile.Read(pBuf,nSourceSize); 74 75 UT_CHECK( Read, nCount == nSourceSize ); 76 77 return ret; 78 } 79 80 FUT_DECL( File, Write ) 81 { 82 bool ret = true; 83 84 85 86 return ret; 87 } 88 89 FUT_DECL( File, Seek ) 90 { 91 bool ret = true; 92 93 94 95 return ret; 96 } 97 98 FUT_DECL( File, SeekBack ) 99 { 100 bool ret = true; 101 102 103 104 return ret; 105 } 106 107 FUT_DECL( File, SeekRelative ) 108 { 109 bool ret = true; 110 111 112 113 return ret; 114 } 115 116 117 118