test/large_file.cc

Code
Comments
Other
Rev Date Author Line
712 21 Dec 06 jari 1 // $Id$
712 21 Dec 06 jari 2
712 21 Dec 06 jari 3 /*
2119 12 Dec 09 peter 4   Copyright (C) 2006 Jari Häkkinen
2119 12 Dec 09 peter 5   Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
4207 26 Aug 22 peter 6   Copyright (C) 2009, 2013, 2022 Peter Johansson
712 21 Dec 06 jari 7
1437 25 Aug 08 peter 8   This file is part of the yat library, http://dev.thep.lu.se/yat
712 21 Dec 06 jari 9
712 21 Dec 06 jari 10   The yat library is free software; you can redistribute it and/or
712 21 Dec 06 jari 11   modify it under the terms of the GNU General Public License as
1486 09 Sep 08 jari 12   published by the Free Software Foundation; either version 3 of the
712 21 Dec 06 jari 13   License, or (at your option) any later version.
712 21 Dec 06 jari 14
712 21 Dec 06 jari 15   The yat library is distributed in the hope that it will be useful,
712 21 Dec 06 jari 16   but WITHOUT ANY WARRANTY; without even the implied warranty of
712 21 Dec 06 jari 17   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
712 21 Dec 06 jari 18   General Public License for more details.
712 21 Dec 06 jari 19
712 21 Dec 06 jari 20   You should have received a copy of the GNU General Public License
1487 10 Sep 08 jari 21   along with yat. If not, see <http://www.gnu.org/licenses/>.
712 21 Dec 06 jari 22 */
712 21 Dec 06 jari 23
3050 12 Jun 13 peter 24 #include <config.h>
1456 30 Aug 08 peter 25
1248 19 Mar 08 peter 26 #include "Suite.h"
1248 19 Mar 08 peter 27
2055 08 Sep 09 peter 28 #include <limits>
712 21 Dec 06 jari 29 #include <string>
1458 30 Aug 08 peter 30 #include <sys/stat.h>
712 21 Dec 06 jari 31
1456 30 Aug 08 peter 32 using namespace theplu::yat;
1456 30 Aug 08 peter 33 void test_large_file_support(test::Suite&);
1456 30 Aug 08 peter 34
1248 19 Mar 08 peter 35 int main(int argc,char* argv[])
4200 19 Aug 22 peter 36 {
1248 19 Mar 08 peter 37   test::Suite suite(argc, argv);
712 21 Dec 06 jari 38
1457 30 Aug 08 peter 39   #ifndef YAT_LFS_DISABLED
1456 30 Aug 08 peter 40   test_large_file_support(suite);
1457 30 Aug 08 peter 41   #else
1457 30 Aug 08 peter 42   suite.err() << "Skipping test of large file support\n";
1458 30 Aug 08 peter 43   exit(77);
1457 30 Aug 08 peter 44   #endif
1248 19 Mar 08 peter 45   return suite.return_value();
712 21 Dec 06 jari 46 }
1456 30 Aug 08 peter 47
1456 30 Aug 08 peter 48 void test_large_file_support(test::Suite& suite)
1456 30 Aug 08 peter 49 {
1456 30 Aug 08 peter 50   bool ok=true;
1456 30 Aug 08 peter 51   suite.err() << "Testing Large File Support\n";
1456 30 Aug 08 peter 52   off_t s = std::numeric_limits<off_t>::max() >> 20;
1456 30 Aug 08 peter 53   suite.err() << "maximal file size: " << s << " Mb" << std::endl;
1456 30 Aug 08 peter 54   suite.add(s>2048);
1456 30 Aug 08 peter 55   if (ok)
1456 30 Aug 08 peter 56     suite.err() << "Ok\n";
1456 30 Aug 08 peter 57   else
1456 30 Aug 08 peter 58     suite.err() << "failed\n";
1456 30 Aug 08 peter 59 }