Changeset 1458
- Timestamp:
- Aug 30, 2008, 9:41:00 PM (15 years ago)
- Location:
- trunk/test
- Files:
-
- 2 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/Makefile.am
r1447 r1458 32 32 check_LTLIBRARIES = libyattest.la 33 33 34 check_PROGRAMS = alignment_test averager_test 34 check_PROGRAMS = alignment_test averager_test \ 35 35 commandline_test \ 36 36 consensus_inputranker_test data_lookup_1d_test \ … … 39 39 index_test inputranker_test \ 40 40 iterator_test kernel_lookup_test kernel_test \ 41 knn_test matrix_lookup_testmatrix_test \41 knn_test large_file_test matrix_lookup_test matrix_test \ 42 42 nbc_test \ 43 43 ncc_test nni_test normalization_test pca_test \ … … 79 79 kernel_lookup_test_SOURCES = kernel_lookup_test.cc 80 80 knn_test_SOURCES = knn_test.cc 81 large_file_test_SOURCES = large_file_test.cc 81 82 matrix_test_SOURCES = matrix_test.cc 82 83 matrix_lookup_test_SOURCES = matrix_lookup_test.cc -
trunk/test/fileutil_test.cc
r1457 r1458 23 23 02111-1307, USA. 24 24 */ 25 26 #ifdef HAVE_CONFIG_H27 #include "config.h"28 #endif29 25 30 26 #include "Suite.h" … … 182 178 } 183 179 184 #ifndef YAT_LFS_DISABLED185 test_large_file_support(suite);186 #else187 suite.err() << "Skipping test of large file support\n";188 #endif189 180 return suite.return_value(); 190 181 } 191 182 192 void test_large_file_support(test::Suite& suite)193 {194 bool ok=true;195 suite.err() << "Testing Large File Support\n";196 off_t s = std::numeric_limits<off_t>::max() >> 20;197 suite.err() << "maximal file size: " << s << " Mb" << std::endl;198 suite.add(s>2048);199 if (ok)200 suite.err() << "Ok\n";201 else202 suite.err() << "failed\n";203 } -
trunk/test/large_file_test.cc
r1457 r1458 2 2 3 3 /* 4 Copyright (C) 2006 Jari Häkkinen5 Copyright (C) 2007 Jari Häkkinen, Peter Johansson6 4 Copyright (C) 2008 Peter Johansson 7 5 … … 30 28 #include "Suite.h" 31 29 32 #include "yat/utility/FileUtil.h"33 #include "yat/utility/Exception.h"34 35 #include <fstream>36 #include <iostream>37 30 #include <string> 31 #include <sys/stat.h> 38 32 39 33 using namespace theplu::yat; … … 43 37 { 44 38 test::Suite suite(argc, argv); 45 suite.err() << "testing FileUtil ... " << std::endl;46 47 // checking permissions for current directory48 try {49 suite.err() << "FileUtil Test 1" << std::endl;50 bool testval=true;51 utility::FileUtil file(".");52 if (testval=file.exists())53 suite.err() << "\tfile exists: " << file.path() << std::endl;54 suite.add(testval);55 if (!(testval=file.permissions("rwx")))56 suite.err() << "\trwx permissions on " << file.path() << std::endl;57 suite.add(!testval);58 if (!(testval=file.permissions("rx")))59 suite.err() << "\trx permissions on " << file.path() << std::endl;60 suite.add(!testval);61 if (!(testval=file.permissions("d")))62 suite.err() << "\td permissions on " << file.path() << std::endl;63 suite.add(!testval);64 }65 catch (utility::IO_error e) {66 suite.add(false);67 suite.err() << e.what() << std::endl;68 }69 70 // checking permissions on non-existent file with ./ in path71 try {72 suite.err() << "FileUtil Test 2" << std::endl;73 bool testval=true;74 // filename below should be unique75 utility::FileUtil file("./fileio_test.sdf34DSF");76 suite.err() << "\tpath: " << std::endl;77 if (!(testval=file.exists()))78 suite.err() << "\tfile does not exist: " << file.path() << std::endl;79 suite.add(!testval);80 if (!(testval=file.permissions("r")))81 suite.err() << "\tr permission on " << file.path() << std::endl;82 suite.add(!testval);83 if (!(testval=file.permissions("rwx")))84 suite.err() << "\trwx permissions on " << file.path() << std::endl;85 suite.add(!testval);86 if (!(testval=file.permissions("w")))87 suite.err() << "\tw permission on " << file.path() << std::endl;88 suite.add(!testval); // 'w' on non-existent file ok if directory writeable89 if (!(testval=file.permissions("d")))90 suite.err() << "\td permission on " << file.path() << std::endl;91 suite.add(!testval);92 }93 catch (utility::IO_error e) {94 suite.add(false);95 suite.err() << e.what() << std::endl;96 }97 98 // checking permissions on non-existent file without ./ in path99 try {100 suite.err() << "FileUtil Test 3" << std::endl;101 bool testval=true;102 // filename below should be unique103 utility::FileUtil file("fileio_test.sdf34DSF");104 if (!(testval=file.exists()))105 suite.err() << "\tfile does not exist: " << file.path() << std::endl;106 suite.add(!testval);107 if (!(testval=file.permissions("r")))108 suite.err() << "\tr permission on " << file.path() << std::endl;109 suite.add(!testval);110 if (!(testval=file.permissions("rwx")))111 suite.err() << "\trwx permissions on " << file.path() << std::endl;112 suite.add(!testval);113 if (!(testval=file.permissions("w")))114 suite.err() << "\tw permission on " << file.path() << std::endl;115 suite.add(!testval); // 'w' on non-existent file ok if directory writeable116 if (!(testval=file.permissions("d")))117 suite.err() << "\td permission on " << file.path() << std::endl;118 suite.add(!testval);119 }120 catch (utility::IO_error e) {121 suite.add(false);122 suite.err() << e.what() << std::endl;123 }124 125 // checking permissions on non-existent file with non-existent126 // directories in path127 try {128 suite.err() << "FileUtil Test 4" << std::endl;129 bool testval=true;130 // intermediate dir must be unique!131 utility::FileUtil file("./fileio_test.sdf34DSF/file");132 if (!(testval=file.exists()))133 suite.err() << "\tfile does not exist: " << file.path() << std::endl;134 suite.add(!testval);135 if ((testval=file.permissions("r")))136 suite.err() << "\tr permission failed on " << file.path() << std::endl;137 suite.add(testval);138 if (testval=file.permissions("rwx"))139 suite.err() << "\trwx permissions failed on " << file.path() << std::endl;140 suite.add(testval);141 if (testval=file.permissions("w"))142 suite.err() << "\tw permission failed on " << file.path() << std::endl;143 suite.add(testval);144 if (testval=file.permissions("d"))145 suite.err() << "\td permission failed on " << file.path() << std::endl;146 suite.add(testval);147 }148 catch (utility::IO_error e) {149 suite.add(false);150 suite.err() << e.what() << std::endl;151 }152 153 // checking permissions on existent file after non-existence file154 // has been checked155 try {156 suite.err() << "FileUtil Test 5" << std::endl;157 bool testval=true;158 // intermediate dir must be unique!159 utility::FileUtil file("./fileio_test.sdf34DSF/file");160 if (!(testval=file.exists()))161 suite.err() << "\tfile does not exist: " << file.path() << std::endl;162 suite.add(!testval);163 utility::FileUtil file2(test::filename("fileutil_test.cc").c_str());164 if (!(testval=!file2.exists()))165 suite.err() << "\tfile does exist: " << file2.path() << std::endl;166 suite.add(!testval);167 }168 catch (utility::IO_error e) {169 suite.add(false);170 suite.err() << e.what() << std::endl;171 }172 173 try {174 suite.err() << "FileUtil Test 6" << std::endl;175 utility::FileUtil file("fileutil_test.cc");176 file.permissions("rxwa"); // should throw177 suite.add(false);178 }179 catch (std::invalid_argument& e) {180 suite.err() << "Expected exception thrown with what: " << e.what()181 << std::endl;182 }183 39 184 40 #ifndef YAT_LFS_DISABLED … … 186 42 #else 187 43 suite.err() << "Skipping test of large file support\n"; 44 exit(77); 188 45 #endif 189 46 return suite.return_value();
Note: See TracChangeset
for help on using the changeset viewer.