1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #define CSV_USE_CSV_ASSERTIONS
21 #include <cosv/csv_env.hxx>
23 #include <cosv/comfunc.hxx>
24 #include <cosv/string.hxx>
25 #include <cosv/streamstr.hxx>
26 #include <cosv/std_outp.hxx>
27 #include <cosv/tpl/dyn.hxx>
28 #include <cosv/file.hxx>
30 // NOT FULLY DECLARED SERVICES
37 UnitTests for class File.
40 FUT_DECL( File
, Read
);
41 FUT_DECL( File
, Write
);
42 FUT_DECL( File
, Seek
);
43 FUT_DECL( File
, SeekBack
);
44 FUT_DECL( File
, SeekRelative
);
50 csv::File
aFile( "bigfile.txt", csv::CFM_RW
, 0 );
51 csv::File
& rFile
= aFile
;
55 bool ret
= ftest_Read( rFile
);
56 ret
= ftest_Write( rFile
) AND ret
;
57 ret
= ftest_SeekBack( rFile
) AND ret
;
58 ret
= ftest_SeekRelative( rFile
) AND ret
;
67 FUT_DECL( File
, Read
)
72 uintt nSourceSize
= rFile
.Position();
75 char * pBuf
= new char[nSourceSize
+1];
76 uintt nCount
= rFile
.Read(pBuf
,nSourceSize
);
78 UT_CHECK( Read
, nCount
== nSourceSize
);
83 FUT_DECL( File
, Write
)
92 FUT_DECL( File
, Seek
)
101 FUT_DECL( File
, SeekBack
)
110 FUT_DECL( File
, SeekRelative
)
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */