libStatGen Software
1
|
00001 /* 00002 * Copyright (C) 2010 Regents of the University of Michigan 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 3 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #include <string> 00018 #include "InputFile.h" 00019 00020 00021 class IFILE_Test : public InputFile 00022 { 00023 public: 00024 void test(); 00025 00026 static const int TEST_FILE_SIZE; 00027 static const int BGZF_TEST_FILE_SIZE; 00028 static const std::string TEST_FILE_CONTENTS; 00029 00030 private: 00031 void testAll(const char* extension); 00032 void test_readFromFile(const char* extension); 00033 void test_readTilChar(const char* extension); 00034 00035 // Tested together because they are used to test each other. 00036 void test_ifeof_ifrewind(const char* extension); 00037 00038 // Tested together to verify they can be successfully be called after the 00039 // other has been called. 00040 void test_ifread_ifgetc(const char* extension); 00041 00042 void test_ifclose(const char* extension); 00043 00044 void test_ifseek(const char* extension); 00045 00046 void test_noExistRead(const char *extension); 00047 00048 void openFile(const char* extension); 00049 void openLargeFile(const char* extension); 00050 void openNoExistFile(const char* extension); 00051 00052 // Buffer used for reading into. 00053 static const int MAX_TEST_BUFFER_SIZE = 100; 00054 char myTestBuffer[MAX_TEST_BUFFER_SIZE]; 00055 00056 };