forked from khampf/g13
-
Notifications
You must be signed in to change notification settings - Fork 1
/
testKeys.cpp
76 lines (62 loc) · 1.96 KB
/
testKeys.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
// #include <catch2/catch.hpp>
//#include <catch2/catch.hpp>
//
//
// TEST_CASE( "Factorials are computed", "[G13Key]" ) {
// SECTION("Key symbols can be found after init") {
// //auto Profile = G13::G13_Profile();
// REQUIRE(true);
// }
//}
#include "g13.hpp"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "g13_manager.hpp"
#include "g13_profile.hpp"
/*
class MockManager : public G13::G13_Manager {
public:
// MOCK_METHOD0(Run,void());
};
*/
class MockDevice : public G13::G13_Device {
public:
// G13_Device(libusb_device *dev, libusb_context *ctx,
// libusb_device_handle *handle, int m_id);
MockDevice(G13::G13_Manager& manager) : G13_Device(nullptr, nullptr, nullptr, 0) {}
};
class MockProfile : public G13::G13_Profile {
public:
MockProfile(G13::G13_Device& device) : G13_Profile(device, std::string("mock")) {}
};
// class MockProfile : public G13::G13_Profile {
// public:
// G13_Profile(G13_Device& keypad, const std::string& name_arg)
// : m_keypad(keypad), m_name(name_arg) {
// _init_keys();
//
// } MOCK_METHOD0(_init_keys, void());
//};
TEST(G13Key, g13_key_maps_to_value) {
G13::G13_Manager* manager = G13::G13_Manager::Instance();
EXPECT_EQ((*manager).FindG13KeyValue("G1"), 0);
EXPECT_EQ((*manager).FindG13KeyValue("G22"), 21);
// G13::G13_Device device = MockDevice(manager);
// G13::G13_Profile Profile = MockProfile(device);
// auto Profile = G13::G13_Profile("",std::string(""),"");
// auto key = Profile.FindKey("KEY_0");
// EXPECT_EQ(key->index(), 10);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
int returnValue;
// Do whatever setup here you will need for your tests here
//
//
returnValue = RUN_ALL_TESTS();
// Do Your teardown here if required
//
//
return returnValue;
}