Macros | Typedefs | Functions
RootOutputClosingCriteria_t.cc File Reference
#include "cetlib/quiet_unit_test.hpp"
#include "art/Framework/IO/ClosingCriteria.h"
#include <thread>

Go to the source code of this file.

Macros

#define BOOST_TEST_MODULE   (RootOutputClosingCriteria_t)
 

Typedefs

using file_size_t = unsigned
 
using no_events_t = unsigned
 
using seconds_t = std::chrono::seconds
 

Functions

 BOOST_AUTO_TEST_CASE (MaxCriteria)
 
 BOOST_AUTO_TEST_CASE (TwoSecondSleep)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (RootOutputClosingCriteria_t)

Definition at line 1 of file RootOutputClosingCriteria_t.cc.

Typedef Documentation

using file_size_t = unsigned

Definition at line 11 of file RootOutputClosingCriteria_t.cc.

using no_events_t = unsigned

Definition at line 12 of file RootOutputClosingCriteria_t.cc.

using seconds_t = std::chrono::seconds

Definition at line 13 of file RootOutputClosingCriteria_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( MaxCriteria  )

Definition at line 32 of file RootOutputClosingCriteria_t.cc.

33 {
34  FileProperties const closingCriteria{
35  max_events, -1u, -1u, -1u, max_size, max_age};
36  ClosingCriteria c{closingCriteria, "Unset"};
37 
38  FileProperties const fp{0, 0, 0, 0, 0, one_second()};
39  BOOST_CHECK(!c.should_close(fp));
40 }
BOOST_AUTO_TEST_CASE ( TwoSecondSleep  )

Definition at line 42 of file RootOutputClosingCriteria_t.cc.

43 {
44  using namespace std::chrono;
45  FileProperties const closingProperties{
46  max_events, -1u, -1u, -1u, max_size, one_second()};
47  ClosingCriteria c{closingProperties, "Unset"};
48 
49  auto const beginTime = steady_clock::now();
50  std::this_thread::sleep_for(seconds_t{2});
51  auto const age = steady_clock::now() - beginTime;
52 
53  FileProperties const currentProperties{
54  0, 0, 0, 0, 0, duration_cast<seconds>(age)};
55  BOOST_CHECK(c.should_close(currentProperties));
56 }
std::chrono::seconds seconds_t