-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a simple testcase for the focus version command
- Loading branch information
Showing
4 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// -*- mode: c++ -*- | ||
// Copyright 2016 Keyboardio, inc. <[email protected]> | ||
// See "LICENSE" for license details | ||
|
||
#include "Kaleidoscope.h" | ||
#include "Kaleidoscope-FocusSerial.h" | ||
|
||
#define KALEIDOSCOPE_FIRMWARE_VERSION "0.1.2" | ||
|
||
#include "Kaleidoscope-FirmwareVersion.h" | ||
// *INDENT-OFF* | ||
// *INDENT-OFF* | ||
|
||
KEYMAPS( | ||
[0] = KEYMAP_STACKED | ||
( | ||
XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX | ||
,XXX | ||
|
||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX ,XXX ,XXX ,XXX | ||
,XXX ,XXX ,XXX ,XXX | ||
,XXX | ||
) | ||
) // KEYMAPS( | ||
|
||
// *INDENT-ON* | ||
|
||
|
||
KALEIDOSCOPE_INIT_PLUGINS(Focus, FirmwareVersion); | ||
|
||
void setup() { | ||
Kaleidoscope.setup(); | ||
} | ||
|
||
void loop() { | ||
Kaleidoscope.loop(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cpu": { | ||
"fqbn": "keyboardio:virtual:model01", | ||
"port": "" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default_fqbn: keyboardio:virtual:model01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "testing/setup-googletest.h" | ||
#include "Kaleidoscope.h" | ||
#include <iostream> | ||
#include "gmock/gmock.h" // For matchers like Eq() | ||
|
||
SETUP_GOOGLETEST(); | ||
|
||
namespace kaleidoscope { | ||
namespace testing { | ||
namespace { | ||
|
||
class FocusVersionCommand : public VirtualDeviceTest {}; | ||
|
||
TEST_F(FocusVersionCommand, SendVersionCommand) { | ||
// Run a cycle to initialize | ||
RunCycle(); | ||
|
||
// Send version command and get response using new helper | ||
auto response = sim_.SendFocusCommand("version"); | ||
|
||
// Response should be exactly the version number | ||
EXPECT_THAT(response, ::testing::Eq("0.1.2")) | ||
<< "Expected version response '0.1.2', got: '" << response << "'"; | ||
} | ||
|
||
} // namespace | ||
} // namespace testing | ||
} // namespace kaleidoscope |