measurement_report_config_test.cpp
Go to the documentation of this file.
1 
27 #include <gtest/gtest.h>
28 #include <boost/asio.hpp>
29 
34 
35 using namespace boost::asio;
36 using namespace omron_os32c_driver;
37 using namespace eip;
38 using namespace eip::serialization;
39 using namespace boost::asio;
40 
41 class MeasurementReportConfigTest : public ::testing ::Test
42 {
43 };
44 
46 {
47  // clang-format off
48  EIP_BYTE d[] = {
49  0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
50  0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF,
57  0xFF, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62  0x00, 0x00, 0x00, 0x00, 0x00, 0x00
63  };
64  // clang-format on
65 
66  BufferReader reader(buffer(d));
68  mrc.deserialize(reader);
69  EXPECT_EQ(sizeof(d), reader.getByteCount());
70  EXPECT_EQ(sizeof(d), mrc.getLength());
71  EXPECT_EQ(0x0001, mrc.sequence_num);
72  EXPECT_EQ(0x00000003, mrc.trigger);
73  EXPECT_EQ(1, mrc.range_report_format);
74  EXPECT_EQ(2, mrc.reflectivity_report_format);
75  for (size_t i = 0; i < 41; ++i)
76  {
77  EXPECT_EQ(0, mrc.beam_selection_mask[i]);
78  }
79  EXPECT_EQ(0xFF, mrc.beam_selection_mask[41]);
80  EXPECT_EQ(0xFF, mrc.beam_selection_mask[42]);
81  EXPECT_EQ(0x0F, mrc.beam_selection_mask[43]);
82  for (size_t i = 44; i < 88; ++i)
83  {
84  EXPECT_EQ(0, mrc.beam_selection_mask[i]);
85  }
86 }
87 
89 {
91  mrc.sequence_num = 0x0001;
92  mrc.trigger = 0x00000003;
93  mrc.range_report_format = 1;
95  memset(mrc.beam_selection_mask, 0, sizeof(mrc.beam_selection_mask));
96  mrc.beam_selection_mask[41] = 0xFF;
97  mrc.beam_selection_mask[42] = 0xFF;
98  mrc.beam_selection_mask[43] = 0x0F;
99 
100  EIP_BYTE d[110];
101  EXPECT_EQ(sizeof(d), mrc.getLength());
102  BufferWriter writer(buffer(d));
103  mrc.serialize(writer);
104  EXPECT_EQ(sizeof(d), writer.getByteCount());
105 
106  EXPECT_EQ(0x01, d[0]);
107  EXPECT_EQ(0x00, d[1]);
108  EXPECT_EQ(0x03, d[2]);
109  EXPECT_EQ(0x00, d[3]);
110  EXPECT_EQ(0x00, d[4]);
111  EXPECT_EQ(0x00, d[5]);
112  EXPECT_EQ(0x01, d[6]);
113  EXPECT_EQ(0x00, d[7]);
114  EXPECT_EQ(0x02, d[8]);
115  EXPECT_EQ(0x00, d[9]);
116  EXPECT_EQ(0x00, d[10]);
117  EXPECT_EQ(0x00, d[11]);
118  EXPECT_EQ(0x00, d[12]);
119  EXPECT_EQ(0x00, d[13]);
120  EXPECT_EQ(0x00, d[14]);
121  EXPECT_EQ(0x00, d[15]);
122  EXPECT_EQ(0x00, d[16]);
123  EXPECT_EQ(0x00, d[17]);
124  EXPECT_EQ(0x00, d[18]);
125  EXPECT_EQ(0x00, d[19]);
126  EXPECT_EQ(0x00, d[20]);
127  EXPECT_EQ(0x00, d[21]);
128  EXPECT_EQ(0x00, d[22]);
129  EXPECT_EQ(0x00, d[23]);
130  EXPECT_EQ(0x00, d[24]);
131  EXPECT_EQ(0x00, d[25]);
132  EXPECT_EQ(0x00, d[26]);
133  EXPECT_EQ(0x00, d[27]);
134  EXPECT_EQ(0x00, d[28]);
135  EXPECT_EQ(0x00, d[29]);
136  EXPECT_EQ(0x00, d[30]);
137  EXPECT_EQ(0x00, d[31]);
138  EXPECT_EQ(0x00, d[32]);
139  EXPECT_EQ(0x00, d[33]);
140  EXPECT_EQ(0x00, d[34]);
141  EXPECT_EQ(0x00, d[35]);
142  EXPECT_EQ(0x00, d[36]);
143  EXPECT_EQ(0x00, d[37]);
144  EXPECT_EQ(0x00, d[38]);
145  EXPECT_EQ(0x00, d[39]);
146  EXPECT_EQ(0x00, d[40]);
147  EXPECT_EQ(0x00, d[41]);
148  EXPECT_EQ(0x00, d[42]);
149  EXPECT_EQ(0x00, d[43]);
150  EXPECT_EQ(0x00, d[44]);
151  EXPECT_EQ(0x00, d[45]);
152  EXPECT_EQ(0x00, d[46]);
153  EXPECT_EQ(0x00, d[47]);
154  EXPECT_EQ(0x00, d[48]);
155  EXPECT_EQ(0x00, d[49]);
156  EXPECT_EQ(0x00, d[50]);
157  EXPECT_EQ(0x00, d[51]);
158  EXPECT_EQ(0x00, d[52]);
159  EXPECT_EQ(0x00, d[53]);
160  EXPECT_EQ(0x00, d[54]);
161  EXPECT_EQ(0x00, d[55]);
162  EXPECT_EQ(0x00, d[56]);
163  EXPECT_EQ(0x00, d[57]);
164  EXPECT_EQ(0x00, d[58]);
165  EXPECT_EQ(0x00, d[59]);
166  EXPECT_EQ(0x00, d[60]);
167  EXPECT_EQ(0x00, d[61]);
168  EXPECT_EQ(0x00, d[62]);
169  EXPECT_EQ(0xFF, d[63]);
170  EXPECT_EQ(0xFF, d[64]);
171  EXPECT_EQ(0x0F, d[65]);
172  EXPECT_EQ(0x00, d[66]);
173  EXPECT_EQ(0x00, d[67]);
174  EXPECT_EQ(0x00, d[68]);
175  EXPECT_EQ(0x00, d[69]);
176  EXPECT_EQ(0x00, d[70]);
177  EXPECT_EQ(0x00, d[71]);
178  EXPECT_EQ(0x00, d[72]);
179  EXPECT_EQ(0x00, d[73]);
180  EXPECT_EQ(0x00, d[74]);
181  EXPECT_EQ(0x00, d[75]);
182  EXPECT_EQ(0x00, d[76]);
183  EXPECT_EQ(0x00, d[77]);
184  EXPECT_EQ(0x00, d[78]);
185  EXPECT_EQ(0x00, d[79]);
186  EXPECT_EQ(0x00, d[80]);
187  EXPECT_EQ(0x00, d[81]);
188  EXPECT_EQ(0x00, d[82]);
189  EXPECT_EQ(0x00, d[83]);
190  EXPECT_EQ(0x00, d[84]);
191  EXPECT_EQ(0x00, d[85]);
192  EXPECT_EQ(0x00, d[86]);
193  EXPECT_EQ(0x00, d[87]);
194  EXPECT_EQ(0x00, d[88]);
195  EXPECT_EQ(0x00, d[89]);
196  EXPECT_EQ(0x00, d[90]);
197  EXPECT_EQ(0x00, d[91]);
198  EXPECT_EQ(0x00, d[92]);
199  EXPECT_EQ(0x00, d[93]);
200  EXPECT_EQ(0x00, d[94]);
201  EXPECT_EQ(0x00, d[95]);
202  EXPECT_EQ(0x00, d[96]);
203  EXPECT_EQ(0x00, d[97]);
204  EXPECT_EQ(0x00, d[98]);
205  EXPECT_EQ(0x00, d[99]);
206  EXPECT_EQ(0x00, d[100]);
207  EXPECT_EQ(0x00, d[101]);
208  EXPECT_EQ(0x00, d[102]);
209  EXPECT_EQ(0x00, d[103]);
210  EXPECT_EQ(0x00, d[104]);
211  EXPECT_EQ(0x00, d[105]);
212  EXPECT_EQ(0x00, d[106]);
213  EXPECT_EQ(0x00, d[107]);
214  EXPECT_EQ(0x00, d[108]);
215  EXPECT_EQ(0x00, d[109]);
216 }
d
virtual Reader & deserialize(Reader &reader, size_t length)
virtual Writer & serialize(Writer &writer) const
uint8_t EIP_BYTE
TEST_F(MeasurementReportConfigTest, test_deserialize)


omron_os32c_driver
Author(s): Kareem Shehata
autogenerated on Fri Nov 27 2020 03:06:12