API
 
Loading...
Searching...
No Matches
logFileRaw_fileTime_error_test.cpp
Go to the documentation of this file.
1/** \file logFileRaw_test.hpp
2 * \brief Tests for the logFileRaw class
3 * \ingroup logger_files
4 */
5
6#include "../../../tests/testXWC.hpp"
7
8#include "../logFileRaw.cpp"
9
11{
12
13class logFileRawTest : public MagAOX::logger::logFileRaw<XWC_DEFAULT_VERBOSITY>
14{
15
17
18 public:
19 std::string testPath;
20
27
28 explicit logFileRawTest( const std::string &lp )
29 {
31
33 }
34
36 {
37 return logFileRawT::createFile( ts );
38 }
39};
40
41
42SCENARIO( "Creating a log file with error from fileTimeRelPath", "[libMagAOX::logger::logFileRaw]" )
43{
44 GIVEN( "A valid timestamp" )
45 {
47
48 // safety check to make sure we don't delete all of /tmp
49 if( lfr.testPath == "/tmp" )
50 {
51 std::cerr << "\nTESTING-ERROR: testPath is just /tmp, so logName is null. Can't go on\n";
52 std::cerr << __FILE__ << ' ' << __LINE__ << "\n\n";
53 REQUIRE( false );
54 return;
55 }
56
57 // First delete the directory and files in case this is a repeat call
58 std::filesystem::remove_all( lfr.testPath );
59
60 flatlogs::timespecX ts1( 0, 0 ); //0,0 is an error in fileTimeRelPath
61
62 mx::error_t rv = lfr.test_createFile( ts1 );
63
64 REQUIRE( rv != mx::error_t::noerror );
65
66 }
67
68}
69
70} // namespace logFileRaw_test
A class to manage raw binary log files.
std::string m_logName
The base name for the log files.
std::string m_logPath
The base path for the log files.
mx::error_t createFile(flatlogs::timespecX &ts)
Create a new file.
mx::error_t test_createFile(flatlogs::timespecX &ts)
MagAOX::logger::logFileRaw< XWC_DEFAULT_VERBOSITY > logFileRawT
SCENARIO("Creating a log file with error from fileTimeRelPath", "[libMagAOX::logger::logFileRaw]")
A fixed-width timespec structure.
Definition timespecX.hpp:35