This commit is contained in:
Neeflix
2018-07-11 09:16:36 +02:00
6 changed files with 22 additions and 12 deletions

View File

@@ -55,15 +55,16 @@ SCENARIO("Creating a Detector object", "")
Detector detector(&gpio_interface_mock.get(), events, &event_notifier_mock.get());
THEN("a thread should be created")
{
REQUIRE(typeid(detector.detect_thread).hash_code() == typeid(std::thread).hash_code());
REQUIRE(typeid(detector.detect_thread).hash_code() == typeid(std::thread).hash_code());
}
AND_WHEN("an event can be found at gpio interface")
{
THEN("only the fitting event should be distributed by event notifier")
{
REQUIRE((bool)Verify(Method(event_notifier_mock, distribute_event).Using(event2)));
}
std::this_thread::sleep_for(std::chrono::milliseconds(50));
THEN("only the fitting event should be distributed by event notifier")
{
REQUIRE((bool)Verify(Method(event_notifier_mock, distribute_event).Using(event2)));
}
}
}
}

View File

@@ -28,7 +28,7 @@ SCENARIO("An EventHandler gets created", "[construction}")
Mock<Input::IInputDriver> input_driver_mock;
Fake(Dtor(input_driver_mock));
When(Method(input_driver_mock, register_event_handler)).AlwaysReturn();
When(Method(input_driver_mock, operator=)).AlwaysReturn();
When(Method(input_driver_mock, unregister_event_handler)).AlwaysReturn();
WHEN("the event handler gets created")
{

View File

@@ -33,7 +33,7 @@ SCENARIO("An EventNotifier gets created", "[construction]")
}
THEN("It creates a notify thread")
{
//REQUIRE(typeid(notifier.notify_thread).hash_code() == typeid(std::thread).hash_code());
REQUIRE(typeid(notifier.notify_thread).hash_code() == typeid(std::thread).hash_code());
}
}
}