2 #include "gtest/gtest.h"
4 #include "KDIS/DataTypes/AntennaLocation.h"
5 #include "KDIS/DataTypes/ArticulatedPart.h"
6 #include "KDIS/DataTypes/AttachedPart.h"
7 #include "KDIS/DataTypes/ClockTime.h"
8 #include "KDIS/DataTypes/CryptoSystem.h"
9 #include "KDIS/DataTypes/DeadReckoningParameter.h"
10 #include "KDIS/DataTypes/Descriptor.h"
11 #include "KDIS/DataTypes/EmissionSystem.h"
12 #include "KDIS/DataTypes/EmitterBeam.h"
13 #include "KDIS/DataTypes/EmitterSystem.h"
14 #include "KDIS/DataTypes/EncodingScheme.h"
15 #include "KDIS/DataTypes/EntityAppearance.h"
16 #include "KDIS/DataTypes/EntityCapabilities.h"
17 #include "KDIS/DataTypes/EntityIdentifier.h"
18 #include "KDIS/DataTypes/EntityMarking.h"
19 #include "KDIS/DataTypes/EntityType.h"
20 #include "KDIS/DataTypes/EulerAngles.h"
21 #include "KDIS/DataTypes/FixedDatum.h"
22 #include "KDIS/DataTypes/FundamentalParameterData.h"
23 #include "KDIS/DataTypes/ModulationType.h"
24 #include "KDIS/DataTypes/MunitionDescriptor.h"
25 #include "KDIS/DataTypes/RadioEntityType.h"
26 #include "KDIS/DataTypes/SimulationIdentifier.h"
27 #include "KDIS/DataTypes/Supplies.h"
28 #include "KDIS/DataTypes/TimeStamp.h"
29 #include "KDIS/DataTypes/TrackJamTargetIdentifier.h"
30 #include "KDIS/DataTypes/VariableDatum.h"
31 #include "KDIS/DataTypes/VariableParameter.h"
32 #include "KDIS/DataTypes/Vector.h"
33 #include "KDIS/DataTypes/WorldCoordinates.h"
36 using namespace DATA_TYPE
;
38 TEST(DataType_EncodeDecode5
, AntennaLocation
)
41 KDataStream stream
= dtIn
.Encode();
42 AntennaLocation
dtOut(stream
);
43 EXPECT_EQ(dtIn
, dtOut
);
44 EXPECT_EQ(0, stream
.GetBufferSize());
47 TEST(DataType_EncodeDecode5
, ArticulatedPart
)
50 KDataStream stream
= dtIn
.Encode();
51 ArticulatedPart
dtOut(stream
);
52 EXPECT_EQ(dtIn
, dtOut
);
53 EXPECT_EQ(0, stream
.GetBufferSize());
56 TEST(DataType_EncodeDecode5
, AttachedPart
)
59 KDataStream stream
= dtIn
.Encode();
60 AttachedPart
dtOut(stream
);
61 EXPECT_EQ(dtIn
, dtOut
);
62 EXPECT_EQ(0, stream
.GetBufferSize());
65 TEST(DataType_EncodeDecode5
, ClockTime
)
68 KDataStream stream
= dtIn
.Encode();
69 ClockTime
dtOut(stream
);
70 EXPECT_EQ(dtIn
, dtOut
);
71 EXPECT_EQ(0, stream
.GetBufferSize());
74 TEST(DataType_EncodeDecode5
, CryptoSystem
)
77 KDataStream stream
= dtIn
.Encode();
78 CryptoSystem
dtOut(stream
);
79 EXPECT_EQ(dtIn
, dtOut
);
80 EXPECT_EQ(0, stream
.GetBufferSize());
83 TEST(DataType_EncodeDecode5
, DeadReckoningParameter
)
85 DeadReckoningParameter dtIn
;
86 KDataStream stream
= dtIn
.Encode();
87 DeadReckoningParameter
dtOut(stream
);
88 EXPECT_EQ(dtIn
, dtOut
);
89 EXPECT_EQ(0, stream
.GetBufferSize());
92 TEST(DataType_EncodeDecode5
, EmissionSystem
)
95 KDataStream stream
= dtIn
.Encode();
96 EmissionSystem
dtOut(stream
);
97 EXPECT_EQ(dtIn
, dtOut
);
98 EXPECT_EQ(0, stream
.GetBufferSize());
101 TEST(DataType_EncodeDecode5
, EmitterBeam
)
104 KDataStream stream
= dtIn
.Encode();
105 EmitterBeam
dtOut(stream
);
106 EXPECT_EQ(dtIn
, dtOut
);
107 EXPECT_EQ(0, stream
.GetBufferSize());
110 TEST(DataType_EncodeDecode5
, EmitterSystem
)
113 KDataStream stream
= dtIn
.Encode();
114 EmitterSystem
dtOut(stream
);
115 EXPECT_EQ(dtIn
, dtOut
);
116 EXPECT_EQ(0, stream
.GetBufferSize());
119 TEST(DataType_EncodeDecode5
, EncodingScheme
)
122 KDataStream stream
= dtIn
.Encode();
123 EncodingScheme
dtOut(stream
);
124 EXPECT_EQ(dtIn
, dtOut
);
125 EXPECT_EQ(0, stream
.GetBufferSize());
128 TEST(DataType_EncodeDecode5
, EntityAppearance
)
130 EntityAppearance dtIn
;
131 KDataStream stream
= dtIn
.Encode();
132 EntityAppearance
dtOut(stream
);
133 EXPECT_EQ(dtIn
, dtOut
);
134 EXPECT_EQ(0, stream
.GetBufferSize());
137 TEST(DataType_EncodeDecode5
, EntityCapabilities
)
139 EntityCapabilities dtIn
;
140 KDataStream stream
= dtIn
.Encode();
141 EntityCapabilities
dtOut(stream
);
142 EXPECT_EQ(dtIn
, dtOut
);
143 EXPECT_EQ(0, stream
.GetBufferSize());
146 TEST(DataType_EncodeDecode5
, EntityIdentifier
)
148 EntityIdentifier dtIn
;
149 KDataStream stream
= dtIn
.Encode();
150 EntityIdentifier
dtOut(stream
);
151 EXPECT_EQ(dtIn
, dtOut
);
152 EXPECT_EQ(0, stream
.GetBufferSize());
155 TEST(DataType_EncodeDecode5
, EntityMarking
)
158 KDataStream stream
= dtIn
.Encode();
159 EntityMarking
dtOut(stream
);
160 EXPECT_EQ(dtIn
, dtOut
);
161 EXPECT_EQ(0, stream
.GetBufferSize());
164 TEST(DataType_EncodeDecode5
, EntityType
)
167 KDataStream stream
= dtIn
.Encode();
168 EntityType
dtOut(stream
);
169 EXPECT_EQ(dtIn
, dtOut
);
170 EXPECT_EQ(0, stream
.GetBufferSize());
173 TEST(DataType_EncodeDecode5
, EulerAngles
)
176 KDataStream stream
= dtIn
.Encode();
177 EulerAngles
dtOut(stream
);
178 EXPECT_EQ(dtIn
, dtOut
);
179 EXPECT_EQ(0, stream
.GetBufferSize());
182 TEST(DataType_EncodeDecode5
, FixedDatum
)
185 KDataStream stream
= dtIn
.Encode();
186 FixedDatum
dtOut(stream
);
187 EXPECT_EQ(dtIn
, dtOut
);
188 EXPECT_EQ(0, stream
.GetBufferSize());
191 TEST(DataType_EncodeDecode5
, FundamentalParameterData
)
193 FundamentalParameterData dtIn
;
194 KDataStream stream
= dtIn
.Encode();
195 FundamentalParameterData
dtOut(stream
);
196 EXPECT_EQ(dtIn
, dtOut
);
197 EXPECT_EQ(0, stream
.GetBufferSize());
200 TEST(DataType_EncodeDecode5
, ModulationType
)
203 KDataStream stream
= dtIn
.Encode();
204 ModulationType
dtOut(stream
);
205 EXPECT_EQ(dtIn
, dtOut
);
206 EXPECT_EQ(0, stream
.GetBufferSize());
209 TEST(DataType_EncodeDecode5
, MunitionDescriptor
)
211 MunitionDescriptor dtIn
;
212 KDataStream stream
= dtIn
.Encode();
213 MunitionDescriptor
dtOut(stream
);
214 EXPECT_EQ(dtIn
, dtOut
);
215 EXPECT_EQ(0, stream
.GetBufferSize());
218 TEST(DataType_EncodeDecode5
, RadioEntityType
)
220 RadioEntityType dtIn
;
221 KDataStream stream
= dtIn
.Encode();
222 RadioEntityType
dtOut(stream
);
223 EXPECT_EQ(dtIn
, dtOut
);
224 EXPECT_EQ(0, stream
.GetBufferSize());
227 TEST(DataType_EncodeDecode5
, SimulationIdentifier
)
229 SimulationIdentifier dtIn
;
230 KDataStream stream
= dtIn
.Encode();
231 SimulationIdentifier
dtOut(stream
);
232 EXPECT_EQ(dtIn
, dtOut
);
233 EXPECT_EQ(0, stream
.GetBufferSize());
236 TEST(DataType_EncodeDecode5
, Supplies
)
239 KDataStream stream
= dtIn
.Encode();
240 Supplies
dtOut(stream
);
241 EXPECT_EQ(dtIn
, dtOut
);
242 EXPECT_EQ(0, stream
.GetBufferSize());
245 TEST(DataType_EncodeDecode5
, TimeStamp
)
248 KDataStream stream
= dtIn
.Encode();
249 TimeStamp
dtOut(stream
);
250 EXPECT_EQ(dtIn
, dtOut
);
251 EXPECT_EQ(0, stream
.GetBufferSize());
254 TEST(DataType_EncodeDecode5
, TrackJamTargetIdentifier
)
256 TrackJamTargetIdentifier dtIn
;
257 KDataStream stream
= dtIn
.Encode();
258 TrackJamTargetIdentifier
dtOut(stream
);
259 EXPECT_EQ(dtIn
, dtOut
);
260 EXPECT_EQ(0, stream
.GetBufferSize());
263 TEST(DataType_EncodeDecode5
, VariableDatum
)
266 KDataStream stream
= dtIn
.Encode();
267 VariableDatum
dtOut(stream
);
268 EXPECT_EQ(dtIn
, dtOut
);
269 EXPECT_EQ(0, stream
.GetBufferSize());
272 TEST(DataType_EncodeDecode5
, VariableParameter
)
274 VariableParameter dtIn
;
275 KDataStream stream
= dtIn
.Encode();
276 VariableParameter
dtOut(stream
);
277 EXPECT_EQ(dtIn
, dtOut
);
278 EXPECT_EQ(0, stream
.GetBufferSize());
281 TEST(DataType_EncodeDecode5
, Vector
)
284 KDataStream stream
= dtIn
.Encode();
285 Vector
dtOut(stream
);
286 EXPECT_EQ(dtIn
, dtOut
);
287 EXPECT_EQ(0, stream
.GetBufferSize());
290 TEST(DataType_EncodeDecode5
, WorldCoordinates
)
292 WorldCoordinates dtIn
;
293 KDataStream stream
= dtIn
.Encode();
294 WorldCoordinates
dtOut(stream
);
295 EXPECT_EQ(dtIn
, dtOut
);
296 EXPECT_EQ(0, stream
.GetBufferSize());