aboutsummaryrefslogtreecommitdiffstats
path: root/tests/basic/test_action_layer.cpp
blob: d00a0859b9c66d87ef92ecbc72b2a6d509b35b4d (plain) (blame)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* Copyright 2017 Colin T.A. Gray
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "test_common.hpp"

using testing::_;
using testing::Return;

class ActionLayer : public TestFixture {};

// TEST_F(ActionLayer, LayerStateDBG) {
//     layer_state_set(0);
// }

// TEST_F(ActionLayer, LayerStateSet) {
//     layer_state_set(0);
//     EXPECT_EQ(layer_state, 0);
//     layer_state_set(0b001100);
//     EXPECT_EQ(layer_state, 0b001100);
// }

// TEST_F(ActionLayer, LayerStateIs) {
//     layer_state_set(0);
//     EXPECT_EQ(layer_state_is(0), true);
//     EXPECT_EQ(layer_state_is(1), true);
//     layer_state_set(1);
//     EXPECT_EQ(layer_state_is(0), true);
//     EXPECT_EQ(layer_state_is(1), true);
//     layer_state_set(2);
//     EXPECT_EQ(layer_state_is(0), false);
//     EXPECT_EQ(layer_state_is(1), false);
//     EXPECT_EQ(layer_state_is(2), true);
// }

TEST_F(ActionLayer, LayerStateCmp) {
    uint32_t prev_layer;

    prev_layer = 0;
    EXPECT_EQ(layer_state_cmp(prev_layer, 0), true);
    EXPECT_EQ(layer_state_cmp(prev_layer, 1), false);

    prev_layer = 1;
    EXPECT_EQ(layer_state_cmp(prev_layer, 0), true);
    EXPECT_EQ(layer_state_cmp(prev_layer, 1), false);

    prev_layer = 2;
    EXPECT_EQ(layer_state_cmp(prev_layer, 0), false);
    EXPECT_EQ(layer_state_cmp(prev_layer, 1), true);
    EXPECT_EQ(layer_state_cmp(prev_layer, 2), false);
}

// TEST_F(ActionLayer, LayerClear) {
//     layer_clear();
//     EXPECT_EQ(layer_state, 0);
// }

// TEST_F(ActionLayer, LayerMove) {
//     layer_move(0);
//     EXPECT_EQ(layer_state, 1);
//     layer_move(3);
//     EXPECT_EQ(layer_state, 0b1000);
// }

// TEST_F(ActionLayer, LayerOn) {
//     layer_clear();
//     layer_on(1);
//     layer_on(3);
//     layer_on(3);
//     EXPECT_EQ(layer_state, 0b1010);
// }

// TEST_F(ActionLayer, LayerOff) {
//     layer_clear();
//     layer_on(1);
//     layer_on(3);
//     layer_off(3);
//     layer_off(2);
//     EXPECT_EQ(layer_state, 0b1000);
// }