// FileType_t.cxx #include "FileType.h" #include using std::cout; using std::endl; using hes::Index; using hes::FileType; int main() { string line = "---------------------------------------"; cout << line << endl; // Check the size of the index. // For now we only need 1 byte so this is trivial. { int nbytes = sizeof(Index); cout << "Index size is " << nbytes << " bytes" << endl; assert( nbytes >= 1 ); cout << line << endl; } // Check that the invalid index is not in the range // of valid indices. { Index inv = FileType::invalid_index(); Index min = FileType::minimum_index(); Index max = FileType::maximum_index(); cout << "min: " << min << endl; cout << "max: " << max << endl; cout << "invalid: " << inv << endl; assert( min < max ); assert( inv < min || inv > max ); cout << line << endl; } { FileType ft; cout << "Test invalid type" << endl; cout << ft << endl; assert( ! ft.is_valid() ); assert( ft == FileType::INVALID ); assert( ft != FileType::BNL_ROOT ); cout << line << endl; } { FileType ft = FileType::TEXT; cout << "Test test type" << endl; cout << ft << endl; assert( ft.index() == 1 ); assert( ft.is_valid() ); assert( ft == FileType::TEXT ); cout << line << endl; } { cout << "Test BNL ROOT type" << endl; FileType ft = FileType::BNL_ROOT; cout << ft << endl; assert( ft.is_valid() ); assert( ft == FileType::BNL_ROOT ); cout << line << endl; } return 0; }