etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
DistinguisherTest.cpp
[詳解]
1 
5 /* コンパイル(平木場)
6 $ g++-7 DistinguisherTest.cpp ../src/Distinguisher.cpp gtest_main.o gtest-all.o -I../include
7 -I../../googletest/googletest/include
8 */
9 
10 #include "Distinguisher.h" // このヘッダファイルのcppファイルをテスト
11 #include <gtest/gtest.h>
12 
13 namespace etrobocon2018_test {
14  class DistinguisherTest : public ::testing::Test {
15  protected:
16  virtual void SetUp() {}
19  void setMockRgb(std::uint16_t r, std::uint16_t g, std::uint16_t b)
20  {
21  d.controller.setMockRgb(r, g, b);
22  }
23  Hsv getRed() { return d.RED; }
24  };
25 
26  TEST_F(DistinguisherTest, getColorWhiteTest2)
27  {
28  setMockRgb(128, 158, 93);
29  Color result = d.getColor();
30  ASSERT_EQ(result, Color::WHITE);
31  }
32 
33  TEST_F(DistinguisherTest, getColorBlackTest1)
34  {
35  setMockRgb(0, 0, 0);
36  Color result = d.getColor();
37  ASSERT_EQ(result, Color::BLACK);
38  }
39 
40  TEST_F(DistinguisherTest, getColorBlackTest2)
41  {
42  setMockRgb(14, 19, 5);
43  Color result = d.getColor();
44  ASSERT_EQ(result, Color::BLACK);
45  }
46 
47 } // namespace etrobocon2018_test
void setMockRgb(std::uint16_t r, std::uint16_t g, std::uint16_t b)
Color
Definition: Distinguisher.h:16
走行体のカラーセンサを用いて、RGB情報より色を推定するクラス。
TEST_F(BlockStrategyTest, createColorBlockPlace)
void setMockRgb(std::uint16_t r, std::uint16_t g, std::uint16_t b)
走行体のカラーセンサを用いて、RGB情報より色を推定するクラス。
Definition: Distinguisher.h:55
色とHsv情報を保持するクラス。
Definition: Distinguisher.h:21