Skip to content

Commit 8e323ff

Browse files
iox-#831 Add test case for cxx::function in PeriodicTimer tests
Signed-off-by: Simon Hoinkis <[email protected]>
1 parent a538d3a commit 8e323ff

File tree

6 files changed

+22
-13
lines changed

6 files changed

+22
-13
lines changed

iceoryx_hoofs/test/moduletests/test_concurrent_periodic_task.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,17 @@ TIMING_TEST_F(PeriodicTask_test, PeriodicTaskRunningWithStdFunction, Repeat(3),
214214
EXPECT_THAT(PeriodicTaskTestType::callCounter, AllOf(Ge(MIN_RUNS), Le(MAX_RUNS)));
215215
});
216216

217+
TIMING_TEST_F(PeriodicTask_test, PeriodicTaskRunningWithCxxFunction, Repeat(3), [&] {
218+
{
219+
concurrent::PeriodicTask<cxx::function<void()>> sut(
220+
PeriodicTaskAutoStart, INTERVAL, "Test", PeriodicTaskTestType::increment);
221+
222+
std::this_thread::sleep_for(SLEEP_TIME);
223+
}
224+
225+
EXPECT_THAT(PeriodicTaskTestType::callCounter, AllOf(Ge(MIN_RUNS), Le(MAX_RUNS)));
226+
});
227+
217228
TIMING_TEST_F(PeriodicTask_test, PeriodicTaskWhichIsActiveAppliesNewIntervalAfterStart, Repeat(3), [&] {
218229
auto start = std::chrono::steady_clock::now();
219230
{

iceoryx_posh/include/iceoryx_posh/internal/popo/wait_set.inl

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ WaitSet<Capacity>::attachImpl(T& eventOrigin,
6969
}
7070
}
7171

72-
cxx::function<void(uint64_t)> invalidationCallback =
73-
NotificationAttorney::getInvalidateTriggerMethod(eventOrigin);
72+
cxx::function<void(uint64_t)> invalidationCallback = NotificationAttorney::getInvalidateTriggerMethod(eventOrigin);
7473
auto index = m_indexRepository.pop();
7574
if (!index)
7675
{

iceoryx_posh/include/iceoryx_posh/internal/roudi/introspection/process_introspection.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#ifndef IOX_POSH_ROUDI_INTROSPECTION_PROCESS_INTROSPECTION_HPP
1818
#define IOX_POSH_ROUDI_INTROSPECTION_PROCESS_INTROSPECTION_HPP
1919

20-
#include "iceoryx_hoofs/cxx/list.hpp"
2120
#include "iceoryx_hoofs/cxx/function.hpp"
21+
#include "iceoryx_hoofs/cxx/list.hpp"
2222
#include "iceoryx_hoofs/internal/concurrent/periodic_task.hpp"
2323
#include "iceoryx_posh/iceoryx_posh_types.hpp"
2424
#include "iceoryx_posh/internal/popo/ports/publisher_port_user.hpp"

iceoryx_posh/include/iceoryx_posh/popo/listener.hpp

+7-8
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,13 @@ class ListenerImpl
176176
class Event_t;
177177

178178
void threadLoop() noexcept;
179-
cxx::expected<uint32_t, ListenerError>
180-
addEvent(void* const origin,
181-
void* const userType,
182-
const uint64_t eventType,
183-
const uint64_t eventTypeHash,
184-
internal::GenericCallbackRef_t callback,
185-
internal::TranslationCallbackRef_t translationCallback,
186-
const cxx::function<void(uint64_t)> invalidationCallback) noexcept;
179+
cxx::expected<uint32_t, ListenerError> addEvent(void* const origin,
180+
void* const userType,
181+
const uint64_t eventType,
182+
const uint64_t eventTypeHash,
183+
internal::GenericCallbackRef_t callback,
184+
internal::TranslationCallbackRef_t translationCallback,
185+
const cxx::function<void(uint64_t)> invalidationCallback) noexcept;
187186

188187
void removeTrigger(const uint64_t index) noexcept;
189188

iceoryx_posh/include/iceoryx_posh/popo/trigger.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
#ifndef IOX_POSH_POPO_TRIGGER_HPP
1818
#define IOX_POSH_POPO_TRIGGER_HPP
1919

20-
#include "iceoryx_hoofs/cxx/helplets.hpp"
2120
#include "iceoryx_hoofs/cxx/function.hpp"
21+
#include "iceoryx_hoofs/cxx/helplets.hpp"
2222
#include "iceoryx_posh/internal/popo/building_blocks/condition_variable_data.hpp"
2323
#include "iceoryx_posh/popo/notification_callback.hpp"
2424
#include "iceoryx_posh/popo/notification_info.hpp"

iceoryx_posh/include/iceoryx_posh/popo/wait_set.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
#define IOX_POSH_POPO_WAIT_SET_HPP
1919

2020
#include "iceoryx_hoofs/cxx/algorithm.hpp"
21+
#include "iceoryx_hoofs/cxx/function.hpp"
2122
#include "iceoryx_hoofs/cxx/function_ref.hpp"
2223
#include "iceoryx_hoofs/cxx/helplets.hpp"
2324
#include "iceoryx_hoofs/cxx/list.hpp"
24-
#include "iceoryx_hoofs/cxx/function.hpp"
2525
#include "iceoryx_hoofs/cxx/stack.hpp"
2626
#include "iceoryx_hoofs/cxx/vector.hpp"
2727
#include "iceoryx_posh/iceoryx_posh_types.hpp"

0 commit comments

Comments
 (0)