|
|
|
@ -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>
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify it under
|
|
|
|
@ -15,7 +15,7 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Kaleidoscope.h"
|
|
|
|
|
#include "testing/common/Simulator.h"
|
|
|
|
|
#include "testing/common/SimHarness.h"
|
|
|
|
|
|
|
|
|
|
#include "testing/common/fix-macros.h"
|
|
|
|
|
#include <iostream>
|
|
|
|
@ -23,21 +23,21 @@
|
|
|
|
|
namespace kaleidoscope {
|
|
|
|
|
namespace testing {
|
|
|
|
|
|
|
|
|
|
void Simulator::RunCycle() {
|
|
|
|
|
void SimHarness::RunCycle() {
|
|
|
|
|
Kaleidoscope.loop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Simulator::RunCycles(size_t n) {
|
|
|
|
|
void SimHarness::RunCycles(size_t n) {
|
|
|
|
|
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(
|
|
|
|
|
KeyAddr{row, col},
|
|
|
|
|
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(
|
|
|
|
|
KeyAddr{row, col},
|
|
|
|
|
kaleidoscope::Device::Props::KeyScanner::KeyState::NotPressed);
|