1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
|
#ifndef FILE_MANAGER_H
#define FILE_MANAGER_H
// Copyright (c) 2000-2002 Clifton Labs, Inc.
// All rights reserved.
// Clifton Labs MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
// THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE, OR NON-INFRINGEMENT. Clifton Labs SHALL NOT BE LIABLE
// FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING,
// RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
// DERIVATIVES.
// By using or copying this Software, Licensee agrees to abide by the
// intellectual property laws, and all other applicable laws of the
// U.S., and the terms of this license.
// Authors: Dale E. Martin dmartin@cliftonlabs.com
#include <string>
using std::string;
class FileManagerTest {
public:
/**
This is a method that runs a self test to see if the FileManager class
is working as expected.
@return 0 if passed, non zero if failed.
*/
int regressionTest();
/**
Return the singleton test object.
*/
static FileManagerTest *instance();
protected:
/** Destructor */
~FileManagerTest(){}
private:
/** Checks to see if we can get an instance of the file manager. */
int instanceTest() const;
/** Attempts to build a directory to run the test in. */
int buildDirectory( const string &dirName ) const;
/** Attempts to build numFile files in the directory passed in. */
int buildFiles( const string &dirName, const string &fileSuffix, const int numFile ) const;
/** Attempts to confirm that the files exist using the file manager. */
int checkFiles( const string &dirName, const string &fileSuffix, const int numFile ) const;
/** Tests to see if we can remove a file. */
int removeFile( const string &dirName, const string &fileSuffix ) const;
/**
Tests to see if we can remove the rest of the files.
*/
int removeFiles( const string &dirName, const string &fileSuffix ) const;
/**
Tests to see if we can remove the directory
*/
int removeDirectory( const string &directoryName ) const;
/**
Tests the basename function.
*/
int baseName();
/** Used to get the filename of the files we're going to test. */
const string buildFileName( const string &dirName,
const string &fileSuffix,
const int fileNumber ) const;
/** Constructor */
FileManagerTest(){}
};
#endif
|