diff options
Diffstat (limited to 'tests/basic/test_action_layer.cpp')
| -rw-r--r-- | tests/basic/test_action_layer.cpp | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/tests/basic/test_action_layer.cpp b/tests/basic/test_action_layer.cpp index d0a28d42c0..883d99b404 100644 --- a/tests/basic/test_action_layer.cpp +++ b/tests/basic/test_action_layer.cpp | |||
| @@ -28,7 +28,7 @@ TEST_F(ActionLayer, LayerStateDBG) { | |||
| 28 | 28 | ||
| 29 | layer_state_set(0); | 29 | layer_state_set(0); |
| 30 | 30 | ||
| 31 | testing::Mock::VerifyAndClearExpectations(&driver); | 31 | VERIFY_AND_CLEAR(driver); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | TEST_F(ActionLayer, LayerStateSet) { | 34 | TEST_F(ActionLayer, LayerStateSet) { |
| @@ -39,7 +39,7 @@ TEST_F(ActionLayer, LayerStateSet) { | |||
| 39 | layer_state_set(0b001100); | 39 | layer_state_set(0b001100); |
| 40 | EXPECT_EQ(layer_state, 0b001100); | 40 | EXPECT_EQ(layer_state, 0b001100); |
| 41 | 41 | ||
| 42 | testing::Mock::VerifyAndClearExpectations(&driver); | 42 | VERIFY_AND_CLEAR(driver); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | TEST_F(ActionLayer, LayerStateIs) { | 45 | TEST_F(ActionLayer, LayerStateIs) { |
| @@ -56,7 +56,7 @@ TEST_F(ActionLayer, LayerStateIs) { | |||
| 56 | EXPECT_EQ(layer_state_is(1), true); | 56 | EXPECT_EQ(layer_state_is(1), true); |
| 57 | EXPECT_EQ(layer_state_is(2), false); | 57 | EXPECT_EQ(layer_state_is(2), false); |
| 58 | 58 | ||
| 59 | testing::Mock::VerifyAndClearExpectations(&driver); | 59 | VERIFY_AND_CLEAR(driver); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | TEST_F(ActionLayer, LayerStateCmp) { | 62 | TEST_F(ActionLayer, LayerStateCmp) { |
| @@ -76,7 +76,7 @@ TEST_F(ActionLayer, LayerStateCmp) { | |||
| 76 | EXPECT_EQ(layer_state_cmp(prev_layer, 1), true); | 76 | EXPECT_EQ(layer_state_cmp(prev_layer, 1), true); |
| 77 | EXPECT_EQ(layer_state_cmp(prev_layer, 2), false); | 77 | EXPECT_EQ(layer_state_cmp(prev_layer, 2), false); |
| 78 | 78 | ||
| 79 | testing::Mock::VerifyAndClearExpectations(&driver); | 79 | VERIFY_AND_CLEAR(driver); |
| 80 | } | 80 | } |
| 81 | 81 | ||
| 82 | TEST_F(ActionLayer, LayerClear) { | 82 | TEST_F(ActionLayer, LayerClear) { |
| @@ -85,7 +85,7 @@ TEST_F(ActionLayer, LayerClear) { | |||
| 85 | layer_clear(); | 85 | layer_clear(); |
| 86 | EXPECT_EQ(layer_state, 0); | 86 | EXPECT_EQ(layer_state, 0); |
| 87 | 87 | ||
| 88 | testing::Mock::VerifyAndClearExpectations(&driver); | 88 | VERIFY_AND_CLEAR(driver); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | TEST_F(ActionLayer, LayerMove) { | 91 | TEST_F(ActionLayer, LayerMove) { |
| @@ -96,7 +96,7 @@ TEST_F(ActionLayer, LayerMove) { | |||
| 96 | layer_move(3); | 96 | layer_move(3); |
| 97 | EXPECT_EQ(layer_state, 0b1000); | 97 | EXPECT_EQ(layer_state, 0b1000); |
| 98 | 98 | ||
| 99 | testing::Mock::VerifyAndClearExpectations(&driver); | 99 | VERIFY_AND_CLEAR(driver); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | TEST_F(ActionLayer, LayerOn) { | 102 | TEST_F(ActionLayer, LayerOn) { |
| @@ -108,7 +108,7 @@ TEST_F(ActionLayer, LayerOn) { | |||
| 108 | layer_on(3); | 108 | layer_on(3); |
| 109 | EXPECT_EQ(layer_state, 0b1010); | 109 | EXPECT_EQ(layer_state, 0b1010); |
| 110 | 110 | ||
| 111 | testing::Mock::VerifyAndClearExpectations(&driver); | 111 | VERIFY_AND_CLEAR(driver); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | TEST_F(ActionLayer, LayerOff) { | 114 | TEST_F(ActionLayer, LayerOff) { |
| @@ -121,7 +121,7 @@ TEST_F(ActionLayer, LayerOff) { | |||
| 121 | layer_off(2); | 121 | layer_off(2); |
| 122 | EXPECT_EQ(layer_state, 0b0010); | 122 | EXPECT_EQ(layer_state, 0b0010); |
| 123 | 123 | ||
| 124 | testing::Mock::VerifyAndClearExpectations(&driver); | 124 | VERIFY_AND_CLEAR(driver); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | TEST_F(ActionLayer, MomentaryLayerDoesNothing) { | 127 | TEST_F(ActionLayer, MomentaryLayerDoesNothing) { |
| @@ -134,12 +134,12 @@ TEST_F(ActionLayer, MomentaryLayerDoesNothing) { | |||
| 134 | EXPECT_NO_REPORT(driver); | 134 | EXPECT_NO_REPORT(driver); |
| 135 | layer_key.press(); | 135 | layer_key.press(); |
| 136 | run_one_scan_loop(); | 136 | run_one_scan_loop(); |
| 137 | testing::Mock::VerifyAndClearExpectations(&driver); | 137 | VERIFY_AND_CLEAR(driver); |
| 138 | 138 | ||
| 139 | EXPECT_NO_REPORT(driver); | 139 | EXPECT_NO_REPORT(driver); |
| 140 | layer_key.release(); | 140 | layer_key.release(); |
| 141 | run_one_scan_loop(); | 141 | run_one_scan_loop(); |
| 142 | testing::Mock::VerifyAndClearExpectations(&driver); | 142 | VERIFY_AND_CLEAR(driver); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | TEST_F(ActionLayer, MomentaryLayerWithKeypress) { | 145 | TEST_F(ActionLayer, MomentaryLayerWithKeypress) { |
| @@ -155,28 +155,28 @@ TEST_F(ActionLayer, MomentaryLayerWithKeypress) { | |||
| 155 | layer_key.press(); | 155 | layer_key.press(); |
| 156 | run_one_scan_loop(); | 156 | run_one_scan_loop(); |
| 157 | EXPECT_TRUE(layer_state_is(1)); | 157 | EXPECT_TRUE(layer_state_is(1)); |
| 158 | testing::Mock::VerifyAndClearExpectations(&driver); | 158 | VERIFY_AND_CLEAR(driver); |
| 159 | 159 | ||
| 160 | /* Press key on layer 1 */ | 160 | /* Press key on layer 1 */ |
| 161 | EXPECT_REPORT(driver, (KC_B)).Times(1); | 161 | EXPECT_REPORT(driver, (KC_B)).Times(1); |
| 162 | regular_key.press(); | 162 | regular_key.press(); |
| 163 | run_one_scan_loop(); | 163 | run_one_scan_loop(); |
| 164 | EXPECT_TRUE(layer_state_is(1)); | 164 | EXPECT_TRUE(layer_state_is(1)); |
| 165 | testing::Mock::VerifyAndClearExpectations(&driver); | 165 | VERIFY_AND_CLEAR(driver); |
| 166 | 166 | ||
| 167 | /* Release key on layer 1 */ | 167 | /* Release key on layer 1 */ |
| 168 | EXPECT_EMPTY_REPORT(driver); | 168 | EXPECT_EMPTY_REPORT(driver); |
| 169 | regular_key.release(); | 169 | regular_key.release(); |
| 170 | run_one_scan_loop(); | 170 | run_one_scan_loop(); |
| 171 | EXPECT_TRUE(layer_state_is(1)); | 171 | EXPECT_TRUE(layer_state_is(1)); |
| 172 | testing::Mock::VerifyAndClearExpectations(&driver); | 172 | VERIFY_AND_CLEAR(driver); |
| 173 | 173 | ||
| 174 | /* Release MO */ | 174 | /* Release MO */ |
| 175 | EXPECT_NO_REPORT(driver); | 175 | EXPECT_NO_REPORT(driver); |
| 176 | layer_key.release(); | 176 | layer_key.release(); |
| 177 | run_one_scan_loop(); | 177 | run_one_scan_loop(); |
| 178 | EXPECT_TRUE(layer_state_is(0)); | 178 | EXPECT_TRUE(layer_state_is(0)); |
| 179 | testing::Mock::VerifyAndClearExpectations(&driver); | 179 | VERIFY_AND_CLEAR(driver); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | TEST_F(ActionLayer, ToggleLayerDoesNothing) { | 182 | TEST_F(ActionLayer, ToggleLayerDoesNothing) { |
| @@ -192,14 +192,14 @@ TEST_F(ActionLayer, ToggleLayerDoesNothing) { | |||
| 192 | layer_key.press(); | 192 | layer_key.press(); |
| 193 | run_one_scan_loop(); | 193 | run_one_scan_loop(); |
| 194 | EXPECT_TRUE(layer_state_is(1)); | 194 | EXPECT_TRUE(layer_state_is(1)); |
| 195 | testing::Mock::VerifyAndClearExpectations(&driver); | 195 | VERIFY_AND_CLEAR(driver); |
| 196 | 196 | ||
| 197 | /* Release TG. */ | 197 | /* Release TG. */ |
| 198 | EXPECT_NO_REPORT(driver); | 198 | EXPECT_NO_REPORT(driver); |
| 199 | layer_key.release(); | 199 | layer_key.release(); |
| 200 | run_one_scan_loop(); | 200 | run_one_scan_loop(); |
| 201 | EXPECT_TRUE(layer_state_is(1)); | 201 | EXPECT_TRUE(layer_state_is(1)); |
| 202 | testing::Mock::VerifyAndClearExpectations(&driver); | 202 | VERIFY_AND_CLEAR(driver); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | TEST_F(ActionLayer, ToggleLayerUpAndDown) { | 205 | TEST_F(ActionLayer, ToggleLayerUpAndDown) { |
| @@ -216,26 +216,26 @@ TEST_F(ActionLayer, ToggleLayerUpAndDown) { | |||
| 216 | toggle_layer_1_on_layer_0.press(); | 216 | toggle_layer_1_on_layer_0.press(); |
| 217 | run_one_scan_loop(); | 217 | run_one_scan_loop(); |
| 218 | EXPECT_TRUE(layer_state_is(1)); | 218 | EXPECT_TRUE(layer_state_is(1)); |
| 219 | testing::Mock::VerifyAndClearExpectations(&driver); | 219 | VERIFY_AND_CLEAR(driver); |
| 220 | 220 | ||
| 221 | EXPECT_NO_REPORT(driver); | 221 | EXPECT_NO_REPORT(driver); |
| 222 | toggle_layer_1_on_layer_0.release(); | 222 | toggle_layer_1_on_layer_0.release(); |
| 223 | run_one_scan_loop(); | 223 | run_one_scan_loop(); |
| 224 | EXPECT_TRUE(layer_state_is(1)); | 224 | EXPECT_TRUE(layer_state_is(1)); |
| 225 | testing::Mock::VerifyAndClearExpectations(&driver); | 225 | VERIFY_AND_CLEAR(driver); |
| 226 | 226 | ||
| 227 | /* Toggle Layer 0. */ | 227 | /* Toggle Layer 0. */ |
| 228 | EXPECT_NO_REPORT(driver); | 228 | EXPECT_NO_REPORT(driver); |
| 229 | toggle_layer_0_on_layer_1.press(); | 229 | toggle_layer_0_on_layer_1.press(); |
| 230 | run_one_scan_loop(); | 230 | run_one_scan_loop(); |
| 231 | EXPECT_TRUE(layer_state_is(0)); | 231 | EXPECT_TRUE(layer_state_is(0)); |
| 232 | testing::Mock::VerifyAndClearExpectations(&driver); | 232 | VERIFY_AND_CLEAR(driver); |
| 233 | 233 | ||
| 234 | EXPECT_NO_REPORT(driver); | 234 | EXPECT_NO_REPORT(driver); |
| 235 | toggle_layer_0_on_layer_1.release(); | 235 | toggle_layer_0_on_layer_1.release(); |
| 236 | run_one_scan_loop(); | 236 | run_one_scan_loop(); |
| 237 | EXPECT_TRUE(layer_state_is(0)); | 237 | EXPECT_TRUE(layer_state_is(0)); |
| 238 | testing::Mock::VerifyAndClearExpectations(&driver); | 238 | VERIFY_AND_CLEAR(driver); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | TEST_F(ActionLayer, LayerTapToggleDoesNothing) { | 241 | TEST_F(ActionLayer, LayerTapToggleDoesNothing) { |
| @@ -251,13 +251,13 @@ TEST_F(ActionLayer, LayerTapToggleDoesNothing) { | |||
| 251 | layer_key.press(); | 251 | layer_key.press(); |
| 252 | run_one_scan_loop(); | 252 | run_one_scan_loop(); |
| 253 | EXPECT_TRUE(layer_state_is(1)); | 253 | EXPECT_TRUE(layer_state_is(1)); |
| 254 | testing::Mock::VerifyAndClearExpectations(&driver); | 254 | VERIFY_AND_CLEAR(driver); |
| 255 | 255 | ||
| 256 | EXPECT_NO_REPORT(driver); | 256 | EXPECT_NO_REPORT(driver); |
| 257 | layer_key.release(); | 257 | layer_key.release(); |
| 258 | run_one_scan_loop(); | 258 | run_one_scan_loop(); |
| 259 | EXPECT_TRUE(layer_state_is(0)); | 259 | EXPECT_TRUE(layer_state_is(0)); |
| 260 | testing::Mock::VerifyAndClearExpectations(&driver); | 260 | VERIFY_AND_CLEAR(driver); |
| 261 | } | 261 | } |
| 262 | 262 | ||
| 263 | TEST_F(ActionLayer, LayerTapToggleWithKeypress) { | 263 | TEST_F(ActionLayer, LayerTapToggleWithKeypress) { |
| @@ -275,25 +275,25 @@ TEST_F(ActionLayer, LayerTapToggleWithKeypress) { | |||
| 275 | layer_key.press(); | 275 | layer_key.press(); |
| 276 | run_one_scan_loop(); | 276 | run_one_scan_loop(); |
| 277 | EXPECT_TRUE(layer_state_is(1)); | 277 | EXPECT_TRUE(layer_state_is(1)); |
| 278 | testing::Mock::VerifyAndClearExpectations(&driver); | 278 | VERIFY_AND_CLEAR(driver); |
| 279 | 279 | ||
| 280 | EXPECT_REPORT(driver, (KC_B)).Times(1); | 280 | EXPECT_REPORT(driver, (KC_B)).Times(1); |
| 281 | regular_key.press(); | 281 | regular_key.press(); |
| 282 | run_one_scan_loop(); | 282 | run_one_scan_loop(); |
| 283 | EXPECT_TRUE(layer_state_is(1)); | 283 | EXPECT_TRUE(layer_state_is(1)); |
| 284 | testing::Mock::VerifyAndClearExpectations(&driver); | 284 | VERIFY_AND_CLEAR(driver); |
| 285 | 285 | ||
| 286 | EXPECT_EMPTY_REPORT(driver); | 286 | EXPECT_EMPTY_REPORT(driver); |
| 287 | regular_key.release(); | 287 | regular_key.release(); |
| 288 | run_one_scan_loop(); | 288 | run_one_scan_loop(); |
| 289 | EXPECT_TRUE(layer_state_is(1)); | 289 | EXPECT_TRUE(layer_state_is(1)); |
| 290 | testing::Mock::VerifyAndClearExpectations(&driver); | 290 | VERIFY_AND_CLEAR(driver); |
| 291 | 291 | ||
| 292 | EXPECT_NO_REPORT(driver); | 292 | EXPECT_NO_REPORT(driver); |
| 293 | layer_key.release(); | 293 | layer_key.release(); |
| 294 | run_one_scan_loop(); | 294 | run_one_scan_loop(); |
| 295 | EXPECT_TRUE(layer_state_is(0)); | 295 | EXPECT_TRUE(layer_state_is(0)); |
| 296 | testing::Mock::VerifyAndClearExpectations(&driver); | 296 | VERIFY_AND_CLEAR(driver); |
| 297 | } | 297 | } |
| 298 | 298 | ||
| 299 | TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) { | 299 | TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) { |
| @@ -344,19 +344,19 @@ TEST_F(ActionLayer, LayerTapToggleWithToggleWithKeypress) { | |||
| 344 | run_one_scan_loop(); | 344 | run_one_scan_loop(); |
| 345 | EXPECT_TRUE(layer_state_is(1)); | 345 | EXPECT_TRUE(layer_state_is(1)); |
| 346 | 346 | ||
| 347 | testing::Mock::VerifyAndClearExpectations(&driver); | 347 | VERIFY_AND_CLEAR(driver); |
| 348 | 348 | ||
| 349 | EXPECT_REPORT(driver, (KC_B)).Times(1); | 349 | EXPECT_REPORT(driver, (KC_B)).Times(1); |
| 350 | regular_key.press(); | 350 | regular_key.press(); |
| 351 | run_one_scan_loop(); | 351 | run_one_scan_loop(); |
| 352 | EXPECT_TRUE(layer_state_is(1)); | 352 | EXPECT_TRUE(layer_state_is(1)); |
| 353 | testing::Mock::VerifyAndClearExpectations(&driver); | 353 | VERIFY_AND_CLEAR(driver); |
| 354 | 354 | ||
| 355 | EXPECT_EMPTY_REPORT(driver); | 355 | EXPECT_EMPTY_REPORT(driver); |
| 356 | regular_key.release(); | 356 | regular_key.release(); |
| 357 | run_one_scan_loop(); | 357 | run_one_scan_loop(); |
| 358 | EXPECT_TRUE(layer_state_is(1)); | 358 | EXPECT_TRUE(layer_state_is(1)); |
| 359 | testing::Mock::VerifyAndClearExpectations(&driver); | 359 | VERIFY_AND_CLEAR(driver); |
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { | 362 | TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { |
| @@ -373,7 +373,7 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { | |||
| 373 | layer_0_key_0.press(); | 373 | layer_0_key_0.press(); |
| 374 | idle_for(TAPPING_TERM); | 374 | idle_for(TAPPING_TERM); |
| 375 | EXPECT_TRUE(layer_state_is(0)); | 375 | EXPECT_TRUE(layer_state_is(0)); |
| 376 | testing::Mock::VerifyAndClearExpectations(&driver); | 376 | VERIFY_AND_CLEAR(driver); |
| 377 | 377 | ||
| 378 | /* Press key with layer 1 mapping, result basically expected | 378 | /* Press key with layer 1 mapping, result basically expected |
| 379 | * altough more reports are send then necessary. */ | 379 | * altough more reports are send then necessary. */ |
| @@ -382,14 +382,14 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { | |||
| 382 | layer_1_key_1.press(); | 382 | layer_1_key_1.press(); |
| 383 | run_one_scan_loop(); | 383 | run_one_scan_loop(); |
| 384 | EXPECT_TRUE(layer_state_is(1)); | 384 | EXPECT_TRUE(layer_state_is(1)); |
| 385 | testing::Mock::VerifyAndClearExpectations(&driver); | 385 | VERIFY_AND_CLEAR(driver); |
| 386 | 386 | ||
| 387 | /* Release layer tap key, no report is send because key is still held. */ | 387 | /* Release layer tap key, no report is send because key is still held. */ |
| 388 | EXPECT_NO_REPORT(driver); | 388 | EXPECT_NO_REPORT(driver); |
| 389 | layer_0_key_0.release(); | 389 | layer_0_key_0.release(); |
| 390 | run_one_scan_loop(); | 390 | run_one_scan_loop(); |
| 391 | EXPECT_TRUE(layer_state_is(0)); | 391 | EXPECT_TRUE(layer_state_is(0)); |
| 392 | testing::Mock::VerifyAndClearExpectations(&driver); | 392 | VERIFY_AND_CLEAR(driver); |
| 393 | 393 | ||
| 394 | /* Unregister keycode and modifier. */ | 394 | /* Unregister keycode and modifier. */ |
| 395 | EXPECT_REPORT(driver, (KC_RALT)).Times(1); | 395 | EXPECT_REPORT(driver, (KC_RALT)).Times(1); |
| @@ -397,5 +397,5 @@ TEST_F(ActionLayer, LayerTapReleasedBeforeKeypressReleaseWithModifiers) { | |||
| 397 | layer_1_key_1.release(); | 397 | layer_1_key_1.release(); |
| 398 | run_one_scan_loop(); | 398 | run_one_scan_loop(); |
| 399 | EXPECT_TRUE(layer_state_is(0)); | 399 | EXPECT_TRUE(layer_state_is(0)); |
| 400 | testing::Mock::VerifyAndClearExpectations(&driver); | 400 | VERIFY_AND_CLEAR(driver); |
| 401 | } | 401 | } |
