diff options
Diffstat (limited to 'tests/basic')
| -rw-r--r-- | tests/basic/test_action_layer.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/tests/basic/test_action_layer.cpp b/tests/basic/test_action_layer.cpp new file mode 100644 index 000000000..d00a0859b --- /dev/null +++ b/tests/basic/test_action_layer.cpp | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | /* Copyright 2017 Colin T.A. Gray | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "test_common.hpp" | ||
| 18 | |||
| 19 | using testing::_; | ||
| 20 | using testing::Return; | ||
| 21 | |||
| 22 | class ActionLayer : public TestFixture {}; | ||
| 23 | |||
| 24 | // TEST_F(ActionLayer, LayerStateDBG) { | ||
| 25 | // layer_state_set(0); | ||
| 26 | // } | ||
| 27 | |||
| 28 | // TEST_F(ActionLayer, LayerStateSet) { | ||
| 29 | // layer_state_set(0); | ||
| 30 | // EXPECT_EQ(layer_state, 0); | ||
| 31 | // layer_state_set(0b001100); | ||
| 32 | // EXPECT_EQ(layer_state, 0b001100); | ||
| 33 | // } | ||
| 34 | |||
| 35 | // TEST_F(ActionLayer, LayerStateIs) { | ||
| 36 | // layer_state_set(0); | ||
| 37 | // EXPECT_EQ(layer_state_is(0), true); | ||
| 38 | // EXPECT_EQ(layer_state_is(1), true); | ||
| 39 | // layer_state_set(1); | ||
| 40 | // EXPECT_EQ(layer_state_is(0), true); | ||
| 41 | // EXPECT_EQ(layer_state_is(1), true); | ||
| 42 | // layer_state_set(2); | ||
| 43 | // EXPECT_EQ(layer_state_is(0), false); | ||
| 44 | // EXPECT_EQ(layer_state_is(1), false); | ||
| 45 | // EXPECT_EQ(layer_state_is(2), true); | ||
| 46 | // } | ||
| 47 | |||
| 48 | TEST_F(ActionLayer, LayerStateCmp) { | ||
| 49 | uint32_t prev_layer; | ||
| 50 | |||
| 51 | prev_layer = 0; | ||
| 52 | EXPECT_EQ(layer_state_cmp(prev_layer, 0), true); | ||
| 53 | EXPECT_EQ(layer_state_cmp(prev_layer, 1), false); | ||
| 54 | |||
| 55 | prev_layer = 1; | ||
| 56 | EXPECT_EQ(layer_state_cmp(prev_layer, 0), true); | ||
| 57 | EXPECT_EQ(layer_state_cmp(prev_layer, 1), false); | ||
| 58 | |||
| 59 | prev_layer = 2; | ||
| 60 | EXPECT_EQ(layer_state_cmp(prev_layer, 0), false); | ||
| 61 | EXPECT_EQ(layer_state_cmp(prev_layer, 1), true); | ||
| 62 | EXPECT_EQ(layer_state_cmp(prev_layer, 2), false); | ||
| 63 | } | ||
| 64 | |||
| 65 | // TEST_F(ActionLayer, LayerClear) { | ||
| 66 | // layer_clear(); | ||
| 67 | // EXPECT_EQ(layer_state, 0); | ||
| 68 | // } | ||
| 69 | |||
| 70 | // TEST_F(ActionLayer, LayerMove) { | ||
| 71 | // layer_move(0); | ||
| 72 | // EXPECT_EQ(layer_state, 1); | ||
| 73 | // layer_move(3); | ||
| 74 | // EXPECT_EQ(layer_state, 0b1000); | ||
| 75 | // } | ||
| 76 | |||
| 77 | // TEST_F(ActionLayer, LayerOn) { | ||
| 78 | // layer_clear(); | ||
| 79 | // layer_on(1); | ||
| 80 | // layer_on(3); | ||
| 81 | // layer_on(3); | ||
| 82 | // EXPECT_EQ(layer_state, 0b1010); | ||
| 83 | // } | ||
| 84 | |||
| 85 | // TEST_F(ActionLayer, LayerOff) { | ||
| 86 | // layer_clear(); | ||
| 87 | // layer_on(1); | ||
| 88 | // layer_on(3); | ||
| 89 | // layer_off(3); | ||
| 90 | // layer_off(2); | ||
| 91 | // EXPECT_EQ(layer_state, 0b1000); | ||
| 92 | // } | ||
