Rename ::kaleidoscope::testing::Simulator to SimHarness.

Signed-off-by: Eric Paniagua <epaniagua@google.com>
epan/testing/readable
Eric Paniagua 4 years ago
parent a89c95cc58
commit dba2d77a97

@ -1,4 +1,4 @@
/* kailedoscope::sim - Simulator for Unit Testing Kaleidoscope /* kailedoscope::sim - Harness for Unit Testing Kaleidoscope
* Copyright (C) 2020 Eric Paniagua <epaniagua@google.com> * Copyright (C) 2020 Eric Paniagua <epaniagua@google.com>
* *
* This program is free software: you can redistribute it and/or modify it under * This program is free software: you can redistribute it and/or modify it under
@ -15,7 +15,7 @@
*/ */
#include "Kaleidoscope.h" #include "Kaleidoscope.h"
#include "testing/common/Simulator.h" #include "testing/common/SimHarness.h"
#include "testing/common/fix-macros.h" #include "testing/common/fix-macros.h"
#include <iostream> #include <iostream>
@ -23,21 +23,21 @@
namespace kaleidoscope { namespace kaleidoscope {
namespace testing { namespace testing {
void Simulator::RunCycle() { void SimHarness::RunCycle() {
Kaleidoscope.loop(); Kaleidoscope.loop();
} }
void Simulator::RunCycles(size_t n) { void SimHarness::RunCycles(size_t n) {
for (size_t i = 0; i < n; ++i) RunCycle(); for (size_t i = 0; i < n; ++i) RunCycle();
} }
void Simulator::Press(uint8_t row, uint8_t col) { void SimHarness::Press(uint8_t row, uint8_t col) {
Kaleidoscope.device().keyScanner().setKeystate( Kaleidoscope.device().keyScanner().setKeystate(
KeyAddr{row, col}, KeyAddr{row, col},
kaleidoscope::Device::Props::KeyScanner::KeyState::Pressed); kaleidoscope::Device::Props::KeyScanner::KeyState::Pressed);
} }
void Simulator::Release(uint8_t row, uint8_t col) { void SimHarness::Release(uint8_t row, uint8_t col) {
Kaleidoscope.device().keyScanner().setKeystate( Kaleidoscope.device().keyScanner().setKeystate(
KeyAddr{row, col}, KeyAddr{row, col},
kaleidoscope::Device::Props::KeyScanner::KeyState::NotPressed); kaleidoscope::Device::Props::KeyScanner::KeyState::NotPressed);

@ -1,5 +1,5 @@
/* kailedoscope::sim - Simulator for Unit Testing Kaleidoscope /* kailedoscope::sim - Simulator for Unit Testing Kaleidoscope
* Copyright (C) 2020 epan <epaniagua@google.com> * Copyright (C) 2020 Eric Paniagua <epaniagua@google.com>
* *
* This program is free software: you can redistribute it and/or modify it under * This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software * the terms of the GNU General Public License as published by the Free Software
@ -22,7 +22,7 @@
namespace kaleidoscope { namespace kaleidoscope {
namespace testing { namespace testing {
class Simulator { class SimHarness {
public: public:
void RunCycle(); void RunCycle();
void RunCycles(size_t n); void RunCycles(size_t n);

@ -18,7 +18,7 @@
#include <cstddef> #include <cstddef>
#include "testing/common/Simulator.h" #include "testing/common/SimHarness.h"
#include "testing/common/State.h" #include "testing/common/State.h"
// Out of order because `fix-macros.h` clears the preprocessor environment for // Out of order because `fix-macros.h` clears the preprocessor environment for
@ -33,10 +33,7 @@ class VirtualDeviceTest : public ::testing::Test {
protected: protected:
std::unique_ptr<State> RunCycle(); std::unique_ptr<State> RunCycle();
// DO NOT REMOVE: This namespace qualification is required. Otherwise the SimHarness sim_;
// linker decides this symbol is really ::kaleidoscope::simulator::Simulator.
// No idea why.
::kaleidoscope::testing::Simulator sim_;
private: private:
State state_; State state_;

Loading…
Cancel
Save