fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / cosv / source / unittest / file_ut.cxx
blob08c8f83a5107bef7dc9c2794a1c1c14f2c8aba21
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
31 #include <ut.hxx>
33 using csv::File;
36 /** @file
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 );
47 bool
48 classtest_File()
50 csv::File aFile( "bigfile.txt", csv::CFM_RW, 0 );
51 csv::File & rFile = aFile;
53 rFile.Open();
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;
60 rFile.Close();
62 return ret;
67 FUT_DECL( File, Read )
69 bool ret = true;
71 rFile.SeekBack(0);
72 uintt nSourceSize = rFile.Position();
73 rFile.Seek(0);
75 char * pBuf = new char[nSourceSize+1];
76 uintt nCount = rFile.Read(pBuf,nSourceSize);
78 UT_CHECK( Read, nCount == nSourceSize );
80 return ret;
83 FUT_DECL( File, Write )
85 bool ret = true;
89 return ret;
92 FUT_DECL( File, Seek )
94 bool ret = true;
98 return ret;
101 FUT_DECL( File, SeekBack )
103 bool ret = true;
107 return ret;
110 FUT_DECL( File, SeekRelative )
112 bool ret = true;
116 return ret;
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */