Skip to content

Commit 72bec4b

Browse files
committed
Format
1 parent ddf1b3f commit 72bec4b

File tree

2 files changed

+26
-78
lines changed

2 files changed

+26
-78
lines changed

swimos_downlink/src/task/tests/event.rs

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,7 @@ async fn link_downlink() {
7474
config,
7575
|mut writer, reader| async move {
7676
let _reader = reader;
77-
writer
78-
.send_value::<i32>(DownlinkNotification::Linked)
79-
.await;
77+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
8078
expect_event(&mut event_rx, TestMessage::Linked).await;
8179
event_rx
8280
},
@@ -106,9 +104,7 @@ async fn message_before_linked() {
106104
writer
107105
.send_value::<i32>(DownlinkNotification::Event { body: 9 })
108106
.await;
109-
writer
110-
.send_value::<i32>(DownlinkNotification::Linked)
111-
.await;
107+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
112108
expect_event(&mut event_rx, TestMessage::Linked).await;
113109
event_rx
114110
},
@@ -135,9 +131,7 @@ async fn message_after_linked() {
135131
config,
136132
|mut writer, reader| async move {
137133
let _reader = reader;
138-
writer
139-
.send_value::<i32>(DownlinkNotification::Linked)
140-
.await;
134+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
141135
writer
142136
.send_value::<i32>(DownlinkNotification::Event { body: 9 })
143137
.await;
@@ -167,9 +161,7 @@ async fn terminate_after_unlinked() {
167161
DownlinkTask::new(model),
168162
config,
169163
|mut writer, reader| async move {
170-
writer
171-
.send_value::<i32>(DownlinkNotification::Linked)
172-
.await;
164+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
173165
writer
174166
.send_value::<i32>(DownlinkNotification::Event { body: 9 })
175167
.await;
@@ -209,9 +201,7 @@ async fn terminate_after_corrupt_frame() {
209201
DownlinkTask::new(model),
210202
config,
211203
|mut writer, reader| async move {
212-
writer
213-
.send_value::<i32>(DownlinkNotification::Linked)
214-
.await;
204+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
215205
expect_event(&mut event_rx, TestMessage::Linked).await;
216206
writer.send_corrupted_frame().await;
217207
(writer, reader, event_rx)
@@ -243,9 +233,7 @@ async fn relink_downlink() {
243233
config,
244234
|mut writer, reader| async move {
245235
let _reader = reader;
246-
writer
247-
.send_value::<i32>(DownlinkNotification::Linked)
248-
.await;
236+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
249237
writer
250238
.send_value::<i32>(DownlinkNotification::Event { body: 9 })
251239
.await;
@@ -255,9 +243,7 @@ async fn relink_downlink() {
255243
writer
256244
.send_value::<i32>(DownlinkNotification::Event { body: 10 })
257245
.await;
258-
writer
259-
.send_value::<i32>(DownlinkNotification::Linked)
260-
.await;
246+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
261247
writer
262248
.send_value::<i32>(DownlinkNotification::Event { body: 11 })
263249
.await;

swimos_downlink/src/task/tests/value.rs

Lines changed: 19 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,7 @@ async fn link_downlink() {
9090
config,
9191
|mut writer, reader| async move {
9292
let _reader = reader;
93-
writer
94-
.send_value::<i32>(DownlinkNotification::Linked)
95-
.await;
93+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
9694
expect_event(&mut event_rx, TestMessage::Linked).await;
9795

9896
event_rx
@@ -121,12 +119,8 @@ async fn invalid_sync_downlink() {
121119
config,
122120
|mut writer, reader| async move {
123121
let _reader = reader;
124-
writer
125-
.send_value::<i32>(DownlinkNotification::Linked)
126-
.await;
127-
writer
128-
.send_value::<i32>(DownlinkNotification::Synced)
129-
.await;
122+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
123+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
130124
expect_event(&mut event_rx, TestMessage::Linked).await;
131125
},
132126
)
@@ -154,15 +148,11 @@ async fn sync_downlink() {
154148
|mut writer, reader| async move {
155149
let _reader = reader;
156150

157-
writer
158-
.send_value::<i32>(DownlinkNotification::Linked)
159-
.await;
151+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
160152
writer
161153
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
162154
.await;
163-
writer
164-
.send_value::<i32>(DownlinkNotification::Synced)
165-
.await;
155+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
166156
expect_event(&mut event_rx, TestMessage::Linked).await;
167157
expect_event(&mut event_rx, TestMessage::Synced(5)).await;
168158
event_rx
@@ -191,9 +181,7 @@ async fn report_events_before_sync() {
191181
config,
192182
|mut writer, reader| async move {
193183
let _reader = reader;
194-
writer
195-
.send_value::<i32>(DownlinkNotification::Linked)
196-
.await;
184+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
197185
writer
198186
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
199187
.await;
@@ -231,15 +219,11 @@ async fn report_events_after_sync() {
231219
config,
232220
|mut writer, reader| async move {
233221
let _reader = reader;
234-
writer
235-
.send_value::<i32>(DownlinkNotification::Linked)
236-
.await;
222+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
237223
writer
238224
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
239225
.await;
240-
writer
241-
.send_value::<i32>(DownlinkNotification::Synced)
242-
.await;
226+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
243227
writer
244228
.send_value::<i32>(DownlinkNotification::Event { body: 67 })
245229
.await;
@@ -272,15 +256,11 @@ async fn terminate_after_unlinked() {
272256
DownlinkTask::new(model),
273257
config,
274258
|mut writer, reader| async move {
275-
writer
276-
.send_value::<i32>(DownlinkNotification::Linked)
277-
.await;
259+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
278260
writer
279261
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
280262
.await;
281-
writer
282-
.send_value::<i32>(DownlinkNotification::Synced)
283-
.await;
263+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
284264
expect_event(&mut event_rx, TestMessage::Linked).await;
285265
expect_event(&mut event_rx, TestMessage::Synced(5)).await;
286266
writer
@@ -318,9 +298,7 @@ async fn terminate_after_corrupt_frame() {
318298
DownlinkTask::new(model),
319299
config,
320300
|mut writer, reader| async move {
321-
writer
322-
.send_value::<i32>(DownlinkNotification::Linked)
323-
.await;
301+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
324302
expect_event(&mut event_rx, TestMessage::Linked).await;
325303
writer.send_corrupted_frame().await;
326304
(writer, reader, event_rx)
@@ -353,24 +331,16 @@ async fn unlink_discards_value() {
353331
config,
354332
|mut writer, reader| async move {
355333
let _reader = reader;
356-
writer
357-
.send_value::<i32>(DownlinkNotification::Linked)
358-
.await;
334+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
359335
writer
360336
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
361337
.await;
362-
writer
363-
.send_value::<i32>(DownlinkNotification::Synced)
364-
.await;
338+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
365339
writer
366340
.send_value::<i32>(DownlinkNotification::Unlinked)
367341
.await;
368-
writer
369-
.send_value::<i32>(DownlinkNotification::Linked)
370-
.await;
371-
writer
372-
.send_value::<i32>(DownlinkNotification::Synced)
373-
.await;
342+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
343+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
374344
expect_event(&mut event_rx, TestMessage::Linked).await;
375345
expect_event(&mut event_rx, TestMessage::Synced(5)).await;
376346
expect_event(&mut event_rx, TestMessage::Unlinked).await;
@@ -399,27 +369,19 @@ async fn relink_downlink() {
399369
config,
400370
|mut writer, reader| async move {
401371
let _reader = reader;
402-
writer
403-
.send_value::<i32>(DownlinkNotification::Linked)
404-
.await;
372+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
405373
writer
406374
.send_value::<i32>(DownlinkNotification::Event { body: 5 })
407375
.await;
408-
writer
409-
.send_value::<i32>(DownlinkNotification::Synced)
410-
.await;
376+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
411377
writer
412378
.send_value::<i32>(DownlinkNotification::Unlinked)
413379
.await;
414-
writer
415-
.send_value::<i32>(DownlinkNotification::Linked)
416-
.await;
380+
writer.send_value::<i32>(DownlinkNotification::Linked).await;
417381
writer
418382
.send_value::<i32>(DownlinkNotification::Event { body: 7 })
419383
.await;
420-
writer
421-
.send_value::<i32>(DownlinkNotification::Synced)
422-
.await;
384+
writer.send_value::<i32>(DownlinkNotification::Synced).await;
423385
expect_event(&mut event_rx, TestMessage::Linked).await;
424386
expect_event(&mut event_rx, TestMessage::Synced(5)).await;
425387
expect_event(&mut event_rx, TestMessage::Unlinked).await;

0 commit comments

Comments
 (0)