19 {
20 nb::module_ m_clock_mock_file = m.def_submodule("clock_mock_file", "Clock mock file utilities for testing");
21
22 nb::class_<PClockMockFile>(m_clock_mock_file, "PClockMockFile")
23
24
25 .def(nb::init<>())
26
27
28 .def("now", &PClockMockFile::now,
29 "Get the mocked current time")
30
31 .def("sleep", [](const PClockMockFile &c, time_t ellapsedTime) {
32 c.sleep(ellapsedTime);
33 },
34 "Sleep for the given elapsed time (no real sleep in mock)")
35
36
37 .def("setCurrentTime", [](PClockMockFile &c, time_t currentTime) {
38 c.setCurrentTime(currentTime);
39 },
40 "Set the mocked current time")
41
42 .def("setMockPrefix", [](PClockMockFile &c, const std::string &prefix) {
43 c.setMockPrefix(prefix);
44 },
45 "Set the mock prefix for logging")
46
47 .def("close", &PClockMockFile::close,
48 "Close the mock file and release resources");
49
50
51 m_clock_mock_file.def("phoenix_createMockBackend", [](PClockMockFile &c, const std::string & prefix) -> bool {
52 return phoenix_createMockBackend(c, prefix);
53 },
54 "Create the mock backend with the given prefix");
55
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);
58 },
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");
61
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);
64 },
65 "Fill the given clock mock with time values");
66}