You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
2.5 KiB

  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. #include "test_common.hpp"
  17. using testing::_;
  18. using testing::Return;
  19. class ActionLayer : public TestFixture {};
  20. // TEST_F(ActionLayer, LayerStateDBG) {
  21. // layer_state_set(0);
  22. // }
  23. // TEST_F(ActionLayer, LayerStateSet) {
  24. // layer_state_set(0);
  25. // EXPECT_EQ(layer_state, 0);
  26. // layer_state_set(0b001100);
  27. // EXPECT_EQ(layer_state, 0b001100);
  28. // }
  29. // TEST_F(ActionLayer, LayerStateIs) {
  30. // layer_state_set(0);
  31. // EXPECT_EQ(layer_state_is(0), true);
  32. // EXPECT_EQ(layer_state_is(1), true);
  33. // layer_state_set(1);
  34. // EXPECT_EQ(layer_state_is(0), true);
  35. // EXPECT_EQ(layer_state_is(1), true);
  36. // layer_state_set(2);
  37. // EXPECT_EQ(layer_state_is(0), false);
  38. // EXPECT_EQ(layer_state_is(1), false);
  39. // EXPECT_EQ(layer_state_is(2), true);
  40. // }
  41. TEST_F(ActionLayer, LayerStateCmp) {
  42. uint32_t prev_layer;
  43. prev_layer = 0;
  44. EXPECT_EQ(layer_state_cmp(prev_layer, 0), true);
  45. EXPECT_EQ(layer_state_cmp(prev_layer, 1), false);
  46. prev_layer = 1;
  47. EXPECT_EQ(layer_state_cmp(prev_layer, 0), true);
  48. EXPECT_EQ(layer_state_cmp(prev_layer, 1), false);
  49. prev_layer = 2;
  50. EXPECT_EQ(layer_state_cmp(prev_layer, 0), false);
  51. EXPECT_EQ(layer_state_cmp(prev_layer, 1), true);
  52. EXPECT_EQ(layer_state_cmp(prev_layer, 2), false);
  53. }
  54. // TEST_F(ActionLayer, LayerClear) {
  55. // layer_clear();
  56. // EXPECT_EQ(layer_state, 0);
  57. // }
  58. // TEST_F(ActionLayer, LayerMove) {
  59. // layer_move(0);
  60. // EXPECT_EQ(layer_state, 1);
  61. // layer_move(3);
  62. // EXPECT_EQ(layer_state, 0b1000);
  63. // }
  64. // TEST_F(ActionLayer, LayerOn) {
  65. // layer_clear();
  66. // layer_on(1);
  67. // layer_on(3);
  68. // layer_on(3);
  69. // EXPECT_EQ(layer_state, 0b1010);
  70. // }
  71. // TEST_F(ActionLayer, LayerOff) {
  72. // layer_clear();
  73. // layer_on(1);
  74. // layer_on(3);
  75. // layer_off(3);
  76. // layer_off(2);
  77. // EXPECT_EQ(layer_state, 0b1000);
  78. // }