refactored everything
This commit is contained in:
@@ -23,8 +23,8 @@
|
||||
|
||||
|
||||
using namespace fakeit;
|
||||
using namespace FlippR_Driver;
|
||||
using namespace Input;
|
||||
using namespace flippR_driver;
|
||||
using namespace input;
|
||||
using namespace utility;
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
|
||||
using namespace fakeit;
|
||||
using namespace FlippR_Driver::utility;
|
||||
using namespace flippR_driver::utility;
|
||||
|
||||
SCENARIO("An EventHandler gets created", "[construction}")
|
||||
{
|
||||
@@ -26,15 +26,15 @@ SCENARIO("An EventHandler gets created", "[construction}")
|
||||
{
|
||||
LoggerFactory::CreateInputTestLogger();
|
||||
|
||||
Mock<FlippR_Driver::Input::IInputDriver> input_driver_mock;
|
||||
Mock<flippR_driver::input::IInputDriver> input_driver_mock;
|
||||
Fake(Dtor(input_driver_mock));
|
||||
When(Method(input_driver_mock, register_event_handler)).AlwaysReturn();
|
||||
When(Method(input_driver_mock, unregister_event_handler)).AlwaysReturn();
|
||||
|
||||
WHEN("the event handler gets created")
|
||||
{
|
||||
std::shared_ptr<FlippR_Driver::Input::IInputDriver> driver_ptr(&input_driver_mock.get());
|
||||
FlippR_Driver::Input::EventHandler handler(driver_ptr);
|
||||
std::shared_ptr<flippR_driver::input::IInputDriver> driver_ptr(&input_driver_mock.get());
|
||||
flippR_driver::input::EventHandler handler(driver_ptr);
|
||||
|
||||
THEN("It should register itself at the input_driver")
|
||||
{
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#include "input/EventNotifier.h"
|
||||
|
||||
using namespace FlippR_Driver;
|
||||
using namespace Input;
|
||||
using namespace flippR_driver;
|
||||
using namespace input;
|
||||
using namespace fakeit;
|
||||
using namespace utility;
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
|
||||
using namespace fakeit;
|
||||
using namespace FlippR_Driver;
|
||||
using namespace Input;
|
||||
using namespace flippR_driver;
|
||||
using namespace input;
|
||||
using namespace utility;
|
||||
|
||||
SCENARIO("An InputDriver gets created", "[construction}")
|
||||
@@ -58,14 +58,14 @@ SCENARIO("An EventHandler [un]registers at the driver", "[un-register]")
|
||||
{
|
||||
LoggerFactory::CreateInputTestLogger();
|
||||
|
||||
Mock<FlippR_Driver::Input::IDetector> detector_mock;
|
||||
Mock<flippR_driver::input::IDetector> detector_mock;
|
||||
Fake(Dtor(detector_mock));
|
||||
|
||||
Mock<IEventHandler> event_handler_mock;
|
||||
Fake(Method(event_handler_mock, handle));
|
||||
Fake(Dtor(event_handler_mock));
|
||||
|
||||
Mock<FlippR_Driver::Input::IEventNotifier> event_notifier_mock;
|
||||
Mock<flippR_driver::input::IEventNotifier> event_notifier_mock;
|
||||
Fake(Method(event_notifier_mock, register_event_handler));
|
||||
Fake(Method(event_notifier_mock, unregister_event_handler));
|
||||
Fake(Dtor(event_notifier_mock));
|
||||
@@ -105,13 +105,13 @@ SCENARIO("An Input Driver is created normally", "")
|
||||
{
|
||||
LoggerFactory::CreateInputTestLogger();
|
||||
|
||||
Mock<FlippR_Driver::Input::IDetector> detector_mock;
|
||||
Mock<flippR_driver::input::IDetector> detector_mock;
|
||||
Fake(Dtor(detector_mock));
|
||||
|
||||
Mock<IEventHandler> event_handler_mock;
|
||||
Fake(Dtor(event_handler_mock));
|
||||
|
||||
Mock<FlippR_Driver::Input::IEventNotifier> event_notifier_mock;
|
||||
Mock<flippR_driver::input::IEventNotifier> event_notifier_mock;
|
||||
Fake(Dtor(event_notifier_mock));
|
||||
|
||||
std::shared_ptr<IEventNotifier> event_notifier_ptr(&event_notifier_mock.get());
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
// testing purposes
|
||||
#define private public
|
||||
|
||||
#include "output/Display.h"
|
||||
#include "Display.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("Creating a Display object", "")
|
||||
{
|
||||
GIVEN("Just a Display with 7 digits")
|
||||
{
|
||||
Display<7> display(5,5);
|
||||
SevenDigitDisplay display(5,5);
|
||||
WHEN("A content is set for the display")
|
||||
{
|
||||
std::string content_string = "1234567";
|
||||
@@ -43,7 +43,7 @@ SCENARIO("Creating a Display object", "")
|
||||
display.write_score(12345);
|
||||
THEN("The content should look like: \" 12345\" ")
|
||||
{
|
||||
std::string content_string = " 12345";
|
||||
std::string content_string = "\0\012345";
|
||||
std::array<char,7> content;
|
||||
std::copy(content_string.begin(), content_string.end(), content.data());
|
||||
|
||||
@@ -51,14 +51,16 @@ SCENARIO("Creating a Display object", "")
|
||||
}
|
||||
}
|
||||
WHEN("A score (12345678), which is longer than the digit is written")
|
||||
display.write_score(12345678);
|
||||
THEN("The content should look like: \"2345678\" ")
|
||||
{
|
||||
std::string content_string = "2345678";
|
||||
std::array<char,7> content;
|
||||
std::copy(content_string.begin(), content_string.end(), content.data());
|
||||
display.write_score(12345678);
|
||||
THEN("The content should look like: \"9999999\"-> highest number ")
|
||||
{
|
||||
std::string content_string = "9999999";
|
||||
std::array<char,7> content;
|
||||
std::copy(content_string.begin(), content_string.end(), content.data());
|
||||
|
||||
REQUIRE(display.content == content);
|
||||
REQUIRE(display.content == content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "output/DisplayController.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "output/Lamp.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "output/OutputDriver.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
// testing purposes
|
||||
#define private public
|
||||
|
||||
#include "output/CabinetItem.h"
|
||||
#include "../../src/output/OutputItem.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "output/Solenoid.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#include "output/Sound.h"
|
||||
|
||||
using namespace FlippR_Driver::output;
|
||||
using namespace flippR_driver::output;
|
||||
using namespace fakeit;
|
||||
|
||||
SCENARIO("")
|
||||
|
||||
Reference in New Issue
Block a user