1
1
import org .junit .jupiter .api .Test ;
2
2
import org .junit .jupiter .api .Disabled ;
3
+ import org .junit .jupiter .api .DisplayName ;
3
4
4
5
import java .util .List ;
5
6
9
10
public class IntergalacticTransmissionTest {
10
11
11
12
@ Test
13
+ @ DisplayName ("calculate transmit sequences" )
12
14
public void calculateTransmitSequencesEmptyMessage () {
13
15
List <Integer > input = List .of ();
14
16
List <Integer > expected = List .of ();
@@ -18,6 +20,7 @@ public void calculateTransmitSequencesEmptyMessage() {
18
20
19
21
@ Disabled ("Remove to run test" )
20
22
@ Test
23
+ @ DisplayName ("0x00 is transmitted as 0x0000" )
21
24
public void calculateTransmitSequences0x00IsTransmittedAs0x0000 () {
22
25
List <Integer > input = List .of (0x00 );
23
26
List <Integer > expected = List .of (0x00 , 0x00 );
@@ -27,6 +30,7 @@ public void calculateTransmitSequences0x00IsTransmittedAs0x0000() {
27
30
28
31
@ Disabled ("Remove to run test" )
29
32
@ Test
33
+ @ DisplayName ("0x02 is transmitted as 0x0300" )
30
34
public void calculateTransmitSequences0x02IsTransmittedAs0x0300 () {
31
35
List <Integer > input = List .of (0x02 );
32
36
List <Integer > expected = List .of (0x03 , 0x00 );
@@ -36,6 +40,7 @@ public void calculateTransmitSequences0x02IsTransmittedAs0x0300() {
36
40
37
41
@ Disabled ("Remove to run test" )
38
42
@ Test
43
+ @ DisplayName ("0x06 is transmitted as 0x0600" )
39
44
public void calculateTransmitSequences0x06IsTransmittedAs0x0600 () {
40
45
List <Integer > input = List .of (0x06 );
41
46
List <Integer > expected = List .of (0x06 , 0x00 );
@@ -45,6 +50,7 @@ public void calculateTransmitSequences0x06IsTransmittedAs0x0600() {
45
50
46
51
@ Disabled ("Remove to run test" )
47
52
@ Test
53
+ @ DisplayName ("0x05 is transmitted as 0x0581" )
48
54
public void calculateTransmitSequences0x05IsTransmittedAs0x0581 () {
49
55
List <Integer > input = List .of (0x05 );
50
56
List <Integer > expected = List .of (0x05 , 0x81 );
@@ -54,6 +60,7 @@ public void calculateTransmitSequences0x05IsTransmittedAs0x0581() {
54
60
55
61
@ Disabled ("Remove to run test" )
56
62
@ Test
63
+ @ DisplayName ("0x29 is transmitted as 0x2881" )
57
64
public void calculateTransmitSequences0x29IsTransmittedAs0x2881 () {
58
65
List <Integer > input = List .of (0x29 );
59
66
List <Integer > expected = List .of (0x28 , 0x81 );
@@ -63,6 +70,7 @@ public void calculateTransmitSequences0x29IsTransmittedAs0x2881() {
63
70
64
71
@ Disabled ("Remove to run test" )
65
72
@ Test
73
+ @ DisplayName ("0xc001c0de is transmitted as 0xc000711be1" )
66
74
public void calculateTransmitSequences0xc001c0deIsTransmittedAs0xc000711be1 () {
67
75
List <Integer > input = List .of (0xc0 , 0x01 , 0xc0 , 0xde );
68
76
List <Integer > expected = List .of (0xc0 , 0x00 , 0x71 , 0x1b , 0xe1 );
@@ -72,6 +80,7 @@ public void calculateTransmitSequences0xc001c0deIsTransmittedAs0xc000711be1() {
72
80
73
81
@ Disabled ("Remove to run test" )
74
82
@ Test
83
+ @ DisplayName ("six byte message" )
75
84
public void calculateTransmitSequencesSixByteMessage () {
76
85
List <Integer > input = List .of (0x47 , 0x72 , 0x65 , 0x61 , 0x74 , 0x21 );
77
86
List <Integer > expected = List .of (0x47 , 0xb8 , 0x99 , 0xac , 0x17 , 0xa0 , 0x84 );
@@ -81,6 +90,7 @@ public void calculateTransmitSequencesSixByteMessage() {
81
90
82
91
@ Disabled ("Remove to run test" )
83
92
@ Test
93
+ @ DisplayName ("at 7 bytes long, no padding is required" )
84
94
public void calculateTransmitSequencesSevenByteMessage () {
85
95
List <Integer > input = List .of (0x47 , 0x72 , 0x65 , 0x61 , 0x74 , 0x31 , 0x21 );
86
96
List <Integer > expected = List .of (0x47 , 0xb8 , 0x99 , 0xac , 0x17 , 0xa0 , 0xc5 , 0x42 );
@@ -90,6 +100,7 @@ public void calculateTransmitSequencesSevenByteMessage() {
90
100
91
101
@ Disabled ("Remove to run test" )
92
102
@ Test
103
+ @ DisplayName ("eight byte message" )
93
104
public void calculateTransmitSequencesEightByteMessage () {
94
105
List <Integer > input = List .of (0xc0 , 0x01 , 0x13 , 0x37 , 0xc0 , 0xde , 0x21 , 0x21 );
95
106
List <Integer > expected = List .of (0xc0 , 0x00 , 0x44 , 0x66 , 0x7d , 0x06 , 0x78 , 0x42 , 0x21 , 0x81 );
@@ -99,6 +110,7 @@ public void calculateTransmitSequencesEightByteMessage() {
99
110
100
111
@ Disabled ("Remove to run test" )
101
112
@ Test
113
+ @ DisplayName ("twenty byte message" )
102
114
public void calculateTransmitSequencesTwentyByteMessage () {
103
115
List <Integer > input = List .of (
104
116
0x45 , 0x78 , 0x65 , 0x72 , 0x63 , 0x69 , 0x73 , 0x6d , 0x20 , 0x69 ,
@@ -113,6 +125,7 @@ public void calculateTransmitSequencesTwentyByteMessage() {
113
125
114
126
@ Disabled ("Remove to run test" )
115
127
@ Test
128
+ @ DisplayName ("empty message" )
116
129
public void decodeReceivedMessagesEmptyMessage () {
117
130
List <Integer > input = List .of ();
118
131
List <Integer > expected = List .of ();
@@ -122,6 +135,7 @@ public void decodeReceivedMessagesEmptyMessage() {
122
135
123
136
@ Disabled ("Remove to run test" )
124
137
@ Test
138
+ @ DisplayName ("zero message" )
125
139
public void decodeReceivedMessagesZeroMessage () {
126
140
List <Integer > input = List .of (0x00 , 0x00 );
127
141
List <Integer > expected = List .of (0x00 );
@@ -131,6 +145,7 @@ public void decodeReceivedMessagesZeroMessage() {
131
145
132
146
@ Disabled ("Remove to run test" )
133
147
@ Test
148
+ @ DisplayName ("0x0300 is decoded to 0x02" )
134
149
public void decodeReceivedMessages0x0300IsDecodedTo0x02 () {
135
150
List <Integer > input = List .of (0x03 , 0x00 );
136
151
List <Integer > expected = List .of (0x02 );
@@ -140,6 +155,7 @@ public void decodeReceivedMessages0x0300IsDecodedTo0x02() {
140
155
141
156
@ Disabled ("Remove to run test" )
142
157
@ Test
158
+ @ DisplayName ("0x0581 is decoded to 0x05" )
143
159
public void decodeReceivedMessages0x0581IsDecodedTo0x05 () {
144
160
List <Integer > input = List .of (0x05 , 0x81 );
145
161
List <Integer > expected = List .of (0x05 );
@@ -149,6 +165,7 @@ public void decodeReceivedMessages0x0581IsDecodedTo0x05() {
149
165
150
166
@ Disabled ("Remove to run test" )
151
167
@ Test
168
+ @ DisplayName ("0x2881 is decoded to 0x29" )
152
169
public void decodeReceivedMessages0x2881IsDecodedTo0x29 () {
153
170
List <Integer > input = List .of (0x28 , 0x81 );
154
171
List <Integer > expected = List .of (0x29 );
@@ -158,6 +175,7 @@ public void decodeReceivedMessages0x2881IsDecodedTo0x29() {
158
175
159
176
@ Disabled ("Remove to run test" )
160
177
@ Test
178
+ @ DisplayName ("first byte has wrong parity" )
161
179
public void decodeFirstByteWrongParity () {
162
180
List <Integer > input = List .of (0x07 , 0x00 );
163
181
assertThrows (IllegalArgumentException .class , ()
@@ -166,6 +184,7 @@ public void decodeFirstByteWrongParity() {
166
184
167
185
@ Disabled ("Remove to run test" )
168
186
@ Test
187
+ @ DisplayName ("second byte has wrong parity" )
169
188
public void decodeSecondByteWrongParity () {
170
189
List <Integer > input = List .of (0x03 , 0x68 );
171
190
assertThrows (IllegalArgumentException .class , ()
@@ -174,6 +193,7 @@ public void decodeSecondByteWrongParity() {
174
193
175
194
@ Disabled ("Remove to run test" )
176
195
@ Test
196
+ @ DisplayName ("0xcf4b00 is decoded to 0xce94" )
177
197
public void decode0xcf4b00To0xce94 () {
178
198
List <Integer > input = List .of (0xcf , 0x4b , 0x00 );
179
199
List <Integer > expected = List .of (0xce , 0x94 );
@@ -183,6 +203,7 @@ public void decode0xcf4b00To0xce94() {
183
203
184
204
@ Disabled ("Remove to run test" )
185
205
@ Test
206
+ @ DisplayName ("0xe2566500 is decoded to 0xe2ad90" )
186
207
public void decode0xe2566500To0xe2ad90 () {
187
208
List <Integer > input = List .of (0xe2 , 0x56 , 0x65 , 0x00 );
188
209
List <Integer > expected = List .of (0xe2 , 0xad , 0x90 );
@@ -192,6 +213,7 @@ public void decode0xe2566500To0xe2ad90() {
192
213
193
214
@ Disabled ("Remove to run test" )
194
215
@ Test
216
+ @ DisplayName ("six byte message" )
195
217
public void decodeSixByteMessage () {
196
218
List <Integer > input = List .of (0x47 , 0xb8 , 0x99 , 0xac , 0x17 , 0xa0 , 0x84 );
197
219
List <Integer > expected = List .of (0x47 , 0x72 , 0x65 , 0x61 , 0x74 , 0x21 );
@@ -201,6 +223,7 @@ public void decodeSixByteMessage() {
201
223
202
224
@ Disabled ("Remove to run test" )
203
225
@ Test
226
+ @ DisplayName ("seven byte message" )
204
227
public void decodeSevenByteMessage () {
205
228
List <Integer > input = List .of (0x47 , 0xb8 , 0x99 , 0xac , 0x17 , 0xa0 , 0xc5 , 0x42 );
206
229
List <Integer > expected = List .of (0x47 , 0x72 , 0x65 , 0x61 , 0x74 , 0x31 , 0x21 );
@@ -210,6 +233,7 @@ public void decodeSevenByteMessage() {
210
233
211
234
@ Disabled ("Remove to run test" )
212
235
@ Test
236
+ @ DisplayName ("last byte has wrong parity" )
213
237
public void decodeLastByteWrongParity () {
214
238
List <Integer > input = List .of (0x47 , 0xb8 , 0x99 , 0xac , 0x17 , 0xa0 , 0xc5 , 0x43 );
215
239
assertThrows (IllegalArgumentException .class , ()
@@ -218,6 +242,7 @@ public void decodeLastByteWrongParity() {
218
242
219
243
@ Disabled ("Remove to run test" )
220
244
@ Test
245
+ @ DisplayName ("eight byte message" )
221
246
public void decodeEightByteMessage () {
222
247
List <Integer > input = List .of (0xc0 , 0x00 , 0x44 , 0x66 , 0x7d , 0x06 , 0x78 , 0x42 , 0x21 , 0x81 );
223
248
List <Integer > expected = List .of (0xc0 , 0x01 , 0x13 , 0x37 , 0xc0 , 0xde , 0x21 , 0x21 );
@@ -227,6 +252,7 @@ public void decodeEightByteMessage() {
227
252
228
253
@ Disabled ("Remove to run test" )
229
254
@ Test
255
+ @ DisplayName ("twenty byte message" )
230
256
public void decodeTwentyByteMessage () {
231
257
List <Integer > input = List .of (
232
258
0x44 , 0xbd , 0x18 , 0xaf , 0x27 , 0x1b , 0xa5 , 0xe7 , 0x6c , 0x90 , 0x1b ,
@@ -240,6 +266,7 @@ public void decodeTwentyByteMessage() {
240
266
241
267
@ Disabled ("Remove to run test" )
242
268
@ Test
269
+ @ DisplayName ("wrong parity on 16th byte" )
243
270
public void decodeWrongParityOn16thByte () {
244
271
List <Integer > input = List .of (
245
272
0x44 , 0xbd , 0x18 , 0xaf , 0x27 , 0x1b , 0xa5 , 0xe7 , 0x6c , 0x90 ,
0 commit comments