20 nb::module_ m_clock_mock_file = m.def_submodule(
"clock_mock_file",
"Clock mock file utilities for testing");
22 nb::class_<PClockMockFile>(m_clock_mock_file,
"PClockMockFile")
28 .def(
"now", &PClockMockFile::now,
29 "Get the mocked current time")
31 .def(
"sleep", [](
const PClockMockFile &c, time_t ellapsedTime) {
32 c.sleep(ellapsedTime);
34 "Sleep for the given elapsed time (no real sleep in mock)")
37 .def(
"setCurrentTime", [](PClockMockFile &c, time_t currentTime) {
38 c.setCurrentTime(currentTime);
40 "Set the mocked current time")
42 .def(
"setMockPrefix", [](PClockMockFile &c,
const std::string &prefix) {
43 c.setMockPrefix(prefix);
45 "Set the mock prefix for logging")
47 .def(
"close", &PClockMockFile::close,
48 "Close the mock file and release resources");
51 m_clock_mock_file.def(
"phoenix_createMockBackend", [](PClockMockFile &c,
const std::string & prefix) ->
bool {
52 return phoenix_createMockBackend(c, prefix);
54 "Create the mock backend with the given prefix");
56 m_clock_mock_file.def(
"phoenix_createClockMock", [](
const std::string & prefix,
size_t nbTime, time_t firstTime, time_t timeIncrement) ->
bool {
57 return phoenix_createClockMock(prefix, nbTime, firstTime, timeIncrement);
59 nb::arg(
"prefix"), nb::arg(
"nbTime"), nb::arg(
"firstTime") = 0l, nb::arg(
"timeIncrement") = 1l,
60 "Create a clock mock with the given prefix, number of time points, first time and time increment");
62 m_clock_mock_file.def(
"phoenix_fillClockMock", [](PClockMockFile &mock,
size_t nbTime, time_t firstTime, time_t timeIncrement) {
63 phoenix_fillClockMock<PClockMockFile>(mock, nbTime, firstTime, timeIncrement);
65 "Fill the given clock mock with time values");