8 if (x.
sym.sym != y.
sym.sym)
return false;
9 if (x.
sym.scancode != y.
sym.scancode)
return false;
10 if (x.
sym.mod != y.
sym.mod)
return false;
11 if (x.
sym.unused != y.
sym.unused)
return false;
16static void test(
const std::string& name1,
SDLKey code1,
bool canonical)
18 std::string name2 = code1.
toString();
20 CHECK(name2 == name1);
25 CHECK(equal(*code2, code1));
27 std::string name3 = code2->toString();
28 CHECK(name3 == name2);
32 CHECK(equal(*code3, *code2));
37 test(
"P", SDLKey::createDown(SDLK_p),
true);
38 test(
"p", SDLKey::createDown(SDLK_p),
false);
39 test(
"1", SDLKey::createDown(SDLK_1),
true);
40 test(
"z", SDLKey::createDown(SDLK_z),
false);
41 test(
"AT", SDLKey::createDown(SDLK_AT),
false);
42 test(
"@", SDLKey::createDown(SDLK_AT),
true);
43 test(
"Hash", SDLKey::createDown(SDLK_HASH),
false);
44 test(
"slash", SDLKey::createDown(SDLK_SLASH),
false);
45 test(
"EXCLAIM", SDLKey::createDown(SDLK_EXCLAIM),
false);
46 test(
"!", SDLKey::createDown(SDLK_EXCLAIM),
true);
47 test(
"PeRiOd", SDLKey::createDown(SDLK_PERIOD),
false);
48 test(
"CARET", SDLKey::createDown(SDLK_CARET),
false);
49 test(
"delete", SDLKey::createDown(SDLK_DELETE),
false);
50 test(
"Keypad 7", SDLKey::createDown(SDLK_KP_7),
true);
51 test(
"KP7", SDLKey::createDown(SDLK_KP_7),
false);
52 test(
"KP_ENTER", SDLKey::createDown(SDLK_KP_ENTER),
false);
53 test(
"up", SDLKey::createDown(SDLK_UP),
false);
54 test(
"End", SDLKey::createDown(SDLK_END),
false);
55 test(
"pageup", SDLKey::createDown(SDLK_PAGEUP),
false);
56 test(
"PageDown", SDLKey::createDown(SDLK_PAGEDOWN),
true);
57 test(
"PAGEDOWN", SDLKey::createDown(SDLK_PAGEDOWN),
false);
58 test(
"F8", SDLKey::createDown(SDLK_F8),
true);
59 test(
"RCTRL", SDLKey::createDown(SDLK_RCTRL),
false);
60 test(
"Right Ctrl", SDLKey::createDown(SDLK_RCTRL),
true);
void test(const IterableBitSet< N > &s, std::initializer_list< size_t > list)
std::unique_ptr< IDEDevice > create(const DeviceConfig &config)
This file implemented 3 utility functions:
T fromString(std::initializer_list< enum_string< T > > list, std::string_view str_)
std::string toString() const