Merge pull request #5 from intothevoid/master
[KDIS.git] / KDIS / Tests / UnitTests / DataType_EncodeDecode7.cpp
blob75fc0475358e462d623be1807bfa7a53cd518218
1 #include <iostream>
2 #include "gtest/gtest.h"
4 #include "KDIS/KDefines.h"
6 #if DIS_VERSION > 6
8 #include "KDIS/DataTypes/AttributeRecordSet.h"
9 #include "KDIS/DataTypes/CommunicationsNodeID.h"
10 #include "KDIS/DataTypes/DEAreaAimpoint.h"
11 #include "KDIS/DataTypes/EnhancedMode1Code.h"
12 #include "KDIS/DataTypes/ExplosionDescriptor.h"
13 #include "KDIS/DataTypes/IFF_Layer3.h"
14 #include "KDIS/DataTypes/IFF_Layer3Interrogator.h"
15 #include "KDIS/DataTypes/IFF_Layer3Transponder.h"
16 #include "KDIS/DataTypes/IOCommunicationsNode.h"
17 #include "KDIS/DataTypes/IOEffect.h"
18 #include "KDIS/DataTypes/Mode5InterrogatorBasicData.h"
19 #include "KDIS/DataTypes/Mode5InterrogatorStatus.h"
20 #include "KDIS/DataTypes/Mode5TransponderBasicData.h"
21 #include "KDIS/DataTypes/Mode5TransponderStatus.h"
22 #include "KDIS/DataTypes/Mode5TransponderSupplementalData.h"
23 #include "KDIS/DataTypes/ModeXCodeRecord.h"
24 #include "KDIS/DataTypes/StandardVariable.h"
26 using namespace KDIS;
27 using namespace DATA_TYPE;
29 TEST(DataType_EncodeDecode7, AttributeRecordSet)
31 AttributeRecordSet dtIn;
32 KDataStream stream = dtIn.Encode();
33 AttributeRecordSet dtOut(stream);
34 EXPECT_EQ(dtIn, dtOut);
35 EXPECT_EQ(0, stream.GetBufferSize());
38 TEST(DataType_EncodeDecode7, CommunicationsNodeID)
40 CommunicationsNodeID dtIn;
41 KDataStream stream = dtIn.Encode();
42 CommunicationsNodeID dtOut(stream);
43 EXPECT_EQ(dtIn, dtOut);
44 EXPECT_EQ(0, stream.GetBufferSize());
47 //TEST(DataType_EncodeDecode7, DEAreaAimpoint)
48 //{
49 // DEAreaAimpoint dtIn;
50 // KDataStream stream = dtIn.Encode();
51 // DEAreaAimpoint dtOut(stream);
52 // EXPECT_EQ(dtIn, dtOut);
53 // EXPECT_EQ(0, stream.GetBufferSize());
54 //}
56 TEST(DataType_EncodeDecode7, EnhancedMode1Code)
58 EnhancedMode1Code dtIn;
59 KDataStream stream = dtIn.Encode();
60 EnhancedMode1Code dtOut(stream);
61 EXPECT_EQ(dtIn, dtOut);
62 EXPECT_EQ(0, stream.GetBufferSize());
65 TEST(DataType_EncodeDecode7, ExplosionDescriptor)
67 ExplosionDescriptor dtIn;
68 KDataStream stream = dtIn.Encode();
69 ExplosionDescriptor dtOut(stream);
70 EXPECT_EQ(dtIn, dtOut);
71 EXPECT_EQ(0, stream.GetBufferSize());
74 TEST(DataType_EncodeDecode7, IFF_Layer3)
76 IFF_Layer3 dtIn;
77 KDataStream stream = dtIn.Encode();
78 IFF_Layer3 dtOut(stream);
79 EXPECT_EQ(dtIn, dtOut);
80 EXPECT_EQ(0, stream.GetBufferSize());
83 TEST(DataType_EncodeDecode7, IFF_Layer3Interrogator)
85 IFF_Layer3Interrogator dtIn;
86 KDataStream stream = dtIn.Encode();
87 IFF_Layer3Interrogator dtOut(stream);
88 EXPECT_EQ(dtIn, dtOut);
89 EXPECT_EQ(0, stream.GetBufferSize());
92 TEST(DataType_EncodeDecode7, IFF_Layer3Transponder)
94 IFF_Layer3Transponder dtIn;
95 KDataStream stream = dtIn.Encode();
96 IFF_Layer3Transponder dtOut(stream);
97 EXPECT_EQ(dtIn, dtOut);
98 EXPECT_EQ(0, stream.GetBufferSize());
101 TEST(DataType_EncodeDecode7, IOCommunicationsNode)
103 IOCommunicationsNode dtIn;
104 KDataStream stream = dtIn.Encode();
105 IOCommunicationsNode dtOut(stream);
106 EXPECT_EQ(dtIn, dtOut);
107 EXPECT_EQ(0, stream.GetBufferSize());
110 TEST(DataType_EncodeDecode7, IOEffect)
112 IOEffect dtIn;
113 KDataStream stream = dtIn.Encode();
114 IOEffect dtOut(stream);
115 EXPECT_EQ(dtIn, dtOut);
116 EXPECT_EQ(0, stream.GetBufferSize());
119 TEST(DataType_EncodeDecode7, Mode5InterrogatorBasicData)
121 Mode5InterrogatorBasicData dtIn;
122 KDataStream stream = dtIn.Encode();
123 Mode5InterrogatorBasicData dtOut(stream);
124 EXPECT_EQ(dtIn, dtOut);
125 EXPECT_EQ(0, stream.GetBufferSize());
128 TEST(DataType_EncodeDecode7, Mode5InterrogatorStatus)
130 Mode5InterrogatorStatus dtIn;
131 KDataStream stream = dtIn.Encode();
132 Mode5InterrogatorStatus dtOut(stream);
133 EXPECT_EQ(dtIn, dtOut);
134 EXPECT_EQ(0, stream.GetBufferSize());
137 TEST(DataType_EncodeDecode7, Mode5TransponderBasicData)
139 Mode5TransponderBasicData dtIn;
140 KDataStream stream = dtIn.Encode();
141 Mode5TransponderBasicData dtOut(stream);
142 EXPECT_EQ(dtIn, dtOut);
143 EXPECT_EQ(0, stream.GetBufferSize());
146 TEST(DataType_EncodeDecode7, Mode5TransponderStatus)
148 Mode5TransponderStatus dtIn;
149 KDataStream stream = dtIn.Encode();
150 Mode5TransponderStatus dtOut(stream);
151 EXPECT_EQ(dtIn, dtOut);
152 EXPECT_EQ(0, stream.GetBufferSize());
155 TEST(DataType_EncodeDecode7, Mode5TransponderSupplementalData)
157 Mode5TransponderSupplementalData dtIn;
158 KDataStream stream = dtIn.Encode();
159 Mode5TransponderSupplementalData dtOut(stream);
160 EXPECT_EQ(dtIn, dtOut);
161 EXPECT_EQ(0, stream.GetBufferSize());
164 TEST(DataType_EncodeDecode7, ModeXCodeRecord)
166 ModeXCodeRecord dtIn;
167 KDataStream stream = dtIn.Encode();
168 ModeXCodeRecord dtOut(stream);
169 EXPECT_EQ(dtIn, dtOut);
170 EXPECT_EQ(0, stream.GetBufferSize());
173 TEST(DataType_EncodeDecode7, StandardVariable)
175 StandardVariable dtIn;
176 KDataStream stream = dtIn.Encode();
177 StandardVariable dtOut(stream);
178 EXPECT_EQ(dtIn, dtOut);
179 EXPECT_EQ(0, stream.GetBufferSize());
182 #endif