1
#[allow(unused_imports)]
2
pub use super::*;
3

            
4
#[cfg(test)]
5
#[allow(clippy::float_cmp)] // exactness IS the invariant under test for several cases
6
mod autotest_generated {
7
    use core::{
8
        cell::Cell,
9
        hash::{Hash, Hasher},
10
    };
11

            
12
    use super::*;
13

            
14
    // --- helpers ---------------------------------------------------------
15

            
16
    /// `SensorReading` derives no `Default`, so every test constructs one.
17
    fn reading(kind: SensorKind, x: f32, y: f32, z: f32) -> SensorReading {
18
        SensorReading {
19
            kind,
20
            x,
21
            y,
22
            z,
23
            timestamp_ms: 0,
24
        }
25
    }
26

            
27
    fn accel(x: f32, y: f32, z: f32) -> SensorReading {
28
        reading(SensorKind::Accelerometer, x, y, z)
29
    }
30

            
31
    /// Relative comparison with an absolute floor, for the cases where f32
32
    /// addition is not associative and bit-exactness is not guaranteed.
33
    fn approx(a: f32, b: f32, rel: f32) -> bool {
34
        let scale = a.abs().max(b.abs()).max(1.0);
35
        (a - b).abs() <= rel * scale
36
    }
37

            
38
    /// FNV-1a, so the `Hash` invariant can be checked without `std`.
39
    struct Fnv(u64);
40
    impl Default for Fnv {
41
        fn default() -> Self {
42
            Self(0xcbf2_9ce4_8422_2325)
43
        }
44
    }
45
    impl Hasher for Fnv {
46
        fn finish(&self) -> u64 {
47
            self.0
48
        }
49
        fn write(&mut self, bytes: &[u8]) {
50
            for b in bytes {
51
                self.0 ^= u64::from(*b);
52
                self.0 = self.0.wrapping_mul(0x100_0000_01b3);
53
            }
54
        }
55
    }
56
    fn hash_of<T: Hash>(v: &T) -> u64 {
57
        let mut h = Fnv::default();
58
        v.hash(&mut h);
59
        h.finish()
60
    }
61

            
62
    // --- SensorReading::magnitude (getter) -------------------------------
63

            
64
    /// basic_access: exactly representable Pythagorean triples must come back
65
    /// bit-exact — every intermediate (square, sum, sqrt) is exact in f32.
66
    #[test]
67
    fn magnitude_pythagorean_is_exact() {
68
        assert_eq!(accel(3.0, 4.0, 0.0).magnitude(), 5.0);
69
        assert_eq!(accel(0.0, 3.0, 4.0).magnitude(), 5.0);
70
        assert_eq!(accel(1.0, 2.0, 2.0).magnitude(), 3.0);
71
        assert_eq!(accel(0.0, 0.0, 0.0).magnitude(), 0.0);
72
    }
73

            
74
    /// invariant: a single non-zero axis yields |v| exactly, for values whose
75
    /// square is exactly representable. Holds on all three axes.
76
    #[test]
77
    fn magnitude_single_axis_equals_abs() {
78
        for v in [1.0_f32, -1.0, 0.5, -3.25, 7.5, -1024.0, 65_536.0] {
79
            assert_eq!(accel(v, 0.0, 0.0).magnitude(), v.abs(), "x = {v}");
80
            assert_eq!(accel(0.0, v, 0.0).magnitude(), v.abs(), "y = {v}");
81
            assert_eq!(accel(0.0, 0.0, v).magnitude(), v.abs(), "z = {v}");
82
        }
83
    }
84

            
85
    /// edge_access: an all-negative-zero reading must not produce `-0.0`
86
    /// (squaring clears the sign, so the result is `+0.0`).
87
    #[test]
88
    fn magnitude_negative_zero_yields_positive_zero() {
89
        let m = accel(-0.0, -0.0, -0.0).magnitude();
90
        assert_eq!(m, 0.0);
91
        assert!(m.is_sign_positive(), "expected +0.0, got {m:?}");
92
    }
93

            
94
    /// invariant: magnitude depends only on |x|,|y|,|z| — all 8 sign
95
    /// combinations of the same triple agree bit-for-bit.
96
    #[test]
97
    fn magnitude_is_sign_invariant() {
98
        let base = accel(1.5, 2.5, 3.5).magnitude();
99
        for &sx in &[1.0_f32, -1.0] {
100
            for &sy in &[1.0_f32, -1.0] {
101
                for &sz in &[1.0_f32, -1.0] {
102
                    let m = accel(1.5 * sx, 2.5 * sy, 3.5 * sz).magnitude();
103
                    assert_eq!(m.to_bits(), base.to_bits(), "signs {sx}/{sy}/{sz}");
104
                }
105
            }
106
        }
107
    }
108

            
109
    /// invariant: for any non-NaN input the result is non-negative — never a
110
    /// negative number, never a `-0.0`.
111
    #[test]
112
    fn magnitude_is_never_negative() {
113
        let vals = [
114
            0.0_f32,
115
            -0.0,
116
            1.0,
117
            -1.0,
118
            9.81,
119
            -9.81,
120
            1e-20,
121
            -1e-20,
122
            1e20,
123
            -1e20,
124
            f32::MAX,
125
            f32::MIN,
126
            f32::MIN_POSITIVE,
127
            f32::INFINITY,
128
            f32::NEG_INFINITY,
129
        ];
130
        for &x in &vals {
131
            for &y in &vals {
132
                for &z in &vals {
133
                    let m = accel(x, y, z).magnitude();
134
                    assert!(!m.is_nan(), "unexpected NaN for ({x}, {y}, {z})");
135
                    assert!(m >= 0.0, "negative magnitude {m} for ({x}, {y}, {z})");
136
                    assert!(
137
                        m.is_sign_positive(),
138
                        "negatively-signed magnitude {m:?} for ({x}, {y}, {z})"
139
                    );
140
                }
141
            }
142
        }
143
    }
144

            
145
    /// edge_access: a NaN on any axis poisons the result (no panic, NaN out).
146
    #[test]
147
    fn magnitude_nan_on_any_axis_is_nan() {
148
        assert!(accel(f32::NAN, 0.0, 0.0).magnitude().is_nan());
149
        assert!(accel(0.0, f32::NAN, 0.0).magnitude().is_nan());
150
        assert!(accel(0.0, 0.0, f32::NAN).magnitude().is_nan());
151
        assert!(accel(f32::NAN, f32::NAN, f32::NAN).magnitude().is_nan());
152
        // NaN wins over infinity: inf*inf = inf, but inf + NaN = NaN.
153
        assert!(accel(f32::INFINITY, f32::NAN, 0.0).magnitude().is_nan());
154
        assert!(accel(f32::NEG_INFINITY, 0.0, f32::NAN).magnitude().is_nan());
155
    }
156

            
157
    /// edge_access: an infinite axis (either sign) yields `+inf`, not NaN.
158
    #[test]
159
    fn magnitude_infinite_axis_is_positive_infinity() {
160
        for inf in [f32::INFINITY, f32::NEG_INFINITY] {
161
            assert_eq!(accel(inf, 0.0, 0.0).magnitude(), f32::INFINITY);
162
            assert_eq!(accel(0.0, inf, 0.0).magnitude(), f32::INFINITY);
163
            assert_eq!(accel(1.0, 2.0, inf).magnitude(), f32::INFINITY);
164
        }
165
        assert_eq!(
166
            accel(f32::INFINITY, f32::NEG_INFINITY, f32::INFINITY).magnitude(),
167
            f32::INFINITY
168
        );
169
    }
170

            
171
    /// overflow: the naive `sqrt(x² + y² + z²)` overflows for large-but-finite
172
    /// inputs — the squares exceed `f32::MAX` even though the true magnitude
173
    /// is finite (`|f32::MAX|` would fit). Documents the limitation: the
174
    /// result saturates to `+inf` rather than panicking or wrapping.
175
    #[test]
176
    fn magnitude_overflows_to_infinity_on_huge_finite_input() {
177
        // True magnitude is exactly f32::MAX (finite), but MAX*MAX == inf.
178
        assert!(accel(f32::MAX, 0.0, 0.0).magnitude().is_infinite());
179
        assert!(accel(0.0, f32::MIN, 0.0).magnitude().is_infinite());
180
        assert!(accel(f32::MAX, f32::MAX, f32::MAX)
181
            .magnitude()
182
            .is_infinite());
183
    }
184

            
185
    /// boundary: the exact cliff where squaring stops fitting in f32.
186
    /// `1.8e19² ≈ 3.24e38 < f32::MAX`, `1.9e19² ≈ 3.61e38 > f32::MAX`.
187
    #[test]
188
    fn magnitude_overflow_cliff_per_term_and_in_the_sum() {
189
        // Below the cliff: finite, and accurate.
190
        let below = accel(1.8e19, 0.0, 0.0).magnitude();
191
        assert!(below.is_finite(), "expected finite, got {below}");
192
        assert!(approx(below, 1.8e19, 1e-5), "{below} !~ 1.8e19");
193

            
194
        // Above the cliff: a single term overflows.
195
        assert!(accel(1.9e19, 0.0, 0.0).magnitude().is_infinite());
196

            
197
        // Each term fits, but the *sum* is what overflows: 3 x 1.69e38.
198
        let two_terms = accel(1.3e19, 1.3e19, 0.0).magnitude();
199
        assert!(two_terms.is_finite(), "expected finite, got {two_terms}");
200
        assert!(approx(two_terms, 1.838_477e19, 1e-4), "{two_terms}");
201
        assert!(
202
            accel(1.3e19, 1.3e19, 1.3e19).magnitude().is_infinite(),
203
            "sum of three 1.69e38 squares must overflow to +inf"
204
        );
205
    }
206

            
207
    /// underflow: the mirror image — squaring flushes tiny inputs to zero, so
208
    /// the magnitude of a non-zero vector reads back as exactly 0.0. No panic,
209
    /// no NaN; the reading is simply below the formula's resolution.
210
    #[test]
211
    fn magnitude_underflows_to_zero_on_tiny_input() {
212
        assert_eq!(accel(1e-30, 0.0, 0.0).magnitude(), 0.0);
213
        assert_eq!(accel(0.0, -1e-30, 1e-30).magnitude(), 0.0);
214
        assert_eq!(accel(f32::MIN_POSITIVE, 0.0, 0.0).magnitude(), 0.0);
215
        // Smallest positive subnormal.
216
        assert_eq!(accel(f32::from_bits(1), 0.0, 0.0).magnitude(), 0.0);
217
    }
218

            
219
    /// boundary: just above the underflow cliff (x² lands in the subnormal
220
    /// range) the result is still finite and roughly right.
221
    #[test]
222
    fn magnitude_near_underflow_cliff_is_finite_and_close() {
223
        let m = accel(1e-19, 0.0, 0.0).magnitude();
224
        assert!(m.is_finite() && m > 0.0, "expected small positive, got {m}");
225
        assert!(approx(m, 1e-19, 1e-2), "{m} !~ 1e-19");
226
    }
227

            
228
    /// invariant: scaling by a power of two is exact in IEEE-754, so
229
    /// `magnitude(2v) == 2 * magnitude(v)` bit-for-bit (absent over/underflow).
230
    #[test]
231
    fn magnitude_scaling_by_power_of_two_is_exact() {
232
        let (x, y, z) = (1.5_f32, -2.25_f32, 0.75_f32);
233
        let base = accel(x, y, z).magnitude();
234
        let doubled = accel(2.0 * x, 2.0 * y, 2.0 * z).magnitude();
235
        let halved = accel(0.5 * x, 0.5 * y, 0.5 * z).magnitude();
236
        assert_eq!(doubled, 2.0 * base);
237
        assert_eq!(halved, 0.5 * base);
238
    }
239

            
240
    /// invariant: magnitude is symmetric in its axes (f32 addition is not
241
    /// associative, so only up to a relative epsilon).
242
    #[test]
243
    fn magnitude_is_permutation_stable() {
244
        let (x, y, z) = (0.1_f32, 12_345.678_f32, -0.000_31_f32);
245
        let base = accel(x, y, z).magnitude();
246
        for (a, b, c) in [(x, z, y), (y, x, z), (y, z, x), (z, x, y), (z, y, x)] {
247
            let m = accel(a, b, c).magnitude();
248
            assert!(approx(m, base, 1e-6), "{m} !~ {base} for ({a}, {b}, {c})");
249
        }
250
    }
251

            
252
    /// basic_access: the documented value — an accelerometer at rest reads
253
    /// ~9.81 m/s² total, whichever axis gravity lands on.
254
    #[test]
255
    fn magnitude_accelerometer_at_rest_is_about_9_81() {
256
        for r in [
257
            accel(0.0, -9.81, 0.0),
258
            accel(9.81, 0.0, 0.0),
259
            accel(0.0, 0.0, -9.81),
260
            accel(5.663_8, -5.663_8, -5.663_8), // tilted: 9.81 / sqrt(3) per axis
261
        ] {
262
            let m = r.magnitude();
263
            assert!(approx(m, 9.81, 1e-3), "{m} !~ 9.81 for {r:?}");
264
        }
265
    }
266

            
267
    /// invariant: `kind` and `timestamp_ms` are not part of the computation —
268
    /// including at the extremes of `u64`.
269
    #[test]
270
    fn magnitude_ignores_kind_and_timestamp() {
271
        let expect = accel(1.0, 2.0, 2.0).magnitude().to_bits();
272
        for kind in [
273
            SensorKind::Accelerometer,
274
            SensorKind::Gyroscope,
275
            SensorKind::Magnetometer,
276
        ] {
277
            for timestamp_ms in [0_u64, 1, u64::MAX / 2, u64::MAX] {
278
                let r = SensorReading {
279
                    kind,
280
                    x: 1.0,
281
                    y: 2.0,
282
                    z: 2.0,
283
                    timestamp_ms,
284
                };
285
                assert_eq!(r.magnitude().to_bits(), expect, "{kind:?} @ {timestamp_ms}");
286
            }
287
        }
288
    }
289

            
290
    /// invariant: `&self` getter — repeated calls are bit-identical and the
291
    /// reading is left untouched.
292
    #[test]
293
    fn magnitude_is_deterministic_and_leaves_the_reading_intact() {
294
        let r = accel(0.1, -0.2, 9.79);
295
        let before = r;
296
        let a = r.magnitude();
297
        let b = r.magnitude();
298
        assert_eq!(a.to_bits(), b.to_bits());
299
        assert_eq!(r, before, "magnitude() must not mutate the reading");
300
    }
301

            
302
    // --- SensorReading / SensorKind POD invariants ------------------------
303

            
304
    /// A NaN axis makes the derived `PartialEq` non-reflexive — callers that
305
    /// dedup readings by equality must not assume `r == r`.
306
    #[test]
307
    fn reading_with_nan_axis_is_not_equal_to_itself() {
308
        let nan = accel(f32::NAN, 0.0, 0.0);
309
        let bit_identical = nan; // Copy, so this is the very same bit pattern
310
        assert_ne!(
311
            nan, bit_identical,
312
            "a NaN axis makes PartialEq non-reflexive"
313
        );
314

            
315
        // ... and the FFI wrapper inherits that.
316
        let opt = OptionSensorReading::Some(nan);
317
        let opt_copy = opt;
318
        assert_ne!(opt, opt_copy);
319

            
320
        // A non-NaN reading *is* reflexive.
321
        let ok = accel(1.0, 2.0, 2.0);
322
        assert_eq!(ok, accel(1.0, 2.0, 2.0));
323
    }
324

            
325
    /// The derived `Ord` follows declaration order, and `Hash` agrees with
326
    /// `Eq` (equal values hash equal, the three variants are distinguishable).
327
    #[test]
328
    fn sensor_kind_ordering_and_hash_are_consistent() {
329
        use SensorKind::{Accelerometer, Gyroscope, Magnetometer};
330
        assert!(Accelerometer < Gyroscope);
331
        assert!(Gyroscope < Magnetometer);
332
        assert!(Accelerometer < Magnetometer);
333

            
334
        assert_eq!(hash_of(&Accelerometer), hash_of(&Accelerometer));
335
        assert_ne!(hash_of(&Accelerometer), hash_of(&Gyroscope));
336
        assert_ne!(hash_of(&Gyroscope), hash_of(&Magnetometer));
337

            
338
        // Copy, not move.
339
        let k = Gyroscope;
340
        let copied = k;
341
        assert_eq!(k, copied);
342
    }
343

            
344
    /// FFI layout: `SensorKind` is a `repr(C)` field-less enum, i.e. a C `int`.
345
    #[test]
346
    fn sensor_kind_is_a_c_int() {
347
        assert_eq!(core::mem::size_of::<SensorKind>(), 4);
348
        assert!(
349
            core::mem::size_of::<OptionSensorReading>() > core::mem::size_of::<SensorReading>()
350
        );
351
    }
352

            
353
    // --- OptionSensorReading (FFI wrapper) -------------------------------
354

            
355
    #[test]
356
    fn option_default_is_none() {
357
        let d = OptionSensorReading::default();
358
        assert!(d.is_none());
359
        assert!(!d.is_some());
360
        assert_eq!(d.as_option(), None);
361
        assert_eq!(d.as_ref(), None);
362
        assert_eq!(d.into_option(), None);
363
    }
364

            
365
    /// round-trip: `Option<SensorReading> -> OptionSensorReading -> Option<_>`
366
    /// is the identity, for both variants.
367
    #[test]
368
    fn option_roundtrips_through_the_ffi_wrapper() {
369
        let r = accel(1.0, 2.0, 2.0);
370

            
371
        let wrapped: OptionSensorReading = Some(r).into();
372
        assert!(wrapped.is_some());
373
        assert_eq!(wrapped.into_option(), Some(r));
374
        assert_eq!(Option::<SensorReading>::from(wrapped), Some(r));
375
        assert_eq!(wrapped.as_option(), Some(&r));
376

            
377
        let none: OptionSensorReading = None.into();
378
        assert!(none.is_none());
379
        assert_eq!(none.into_option(), None);
380
        assert_eq!(Option::<SensorReading>::from(none), None);
381

            
382
        // is_some / is_none are strict complements.
383
        for o in [wrapped, none] {
384
            assert_ne!(o.is_some(), o.is_none());
385
        }
386
    }
387

            
388
    /// `replace` has `mem::replace` semantics: it returns the PREVIOUS value.
389
    #[test]
390
    fn option_replace_returns_the_previous_value() {
391
        let first = accel(1.0, 0.0, 0.0);
392
        let second = accel(0.0, 3.0, 4.0);
393

            
394
        let mut o = OptionSensorReading::None;
395
        let prev = o.replace(first);
396
        assert!(prev.is_none(), "replacing None must hand back None");
397
        assert_eq!(o.into_option(), Some(first));
398

            
399
        let prev = o.replace(second);
400
        assert_eq!(prev.into_option(), Some(first));
401
        assert_eq!(o.into_option(), Some(second));
402
        assert_eq!(o.as_option().map(SensorReading::magnitude), Some(5.0));
403
    }
404

            
405
    /// `as_mut` hands out a real mutable borrow of the payload.
406
    #[test]
407
    fn option_as_mut_mutates_the_payload() {
408
        let mut o = OptionSensorReading::Some(accel(0.0, 0.0, 0.0));
409
        assert_eq!(o.as_option().map(SensorReading::magnitude), Some(0.0));
410

            
411
        let slot = o.as_mut().expect("Some");
412
        slot.x = 3.0;
413
        slot.y = 4.0;
414
        assert_eq!(o.as_option().map(SensorReading::magnitude), Some(5.0));
415

            
416
        let mut none = OptionSensorReading::None;
417
        assert!(none.as_mut().is_none());
418
    }
419

            
420
    /// `map` / `and_then` must not run the closure on `None` (and must run it
421
    /// exactly once on `Some`).
422
    #[test]
423
    fn option_map_and_and_then_are_lazy_on_none() {
424
        let calls = Cell::new(0_u32);
425

            
426
        let mapped = OptionSensorReading::None.map(|r| {
427
            calls.set(calls.get() + 1);
428
            r.magnitude()
429
        });
430
        assert_eq!(mapped, None);
431
        assert_eq!(calls.get(), 0, "closure must not run on None");
432

            
433
        let chained = OptionSensorReading::None.and_then(|r| Some(r.magnitude()));
434
        assert_eq!(chained, None);
435

            
436
        let some = OptionSensorReading::Some(accel(3.0, 4.0, 0.0));
437
        let mapped = some.map(|r| {
438
            calls.set(calls.get() + 1);
439
            r.magnitude()
440
        });
441
        assert_eq!(mapped, Some(5.0));
442
        assert_eq!(calls.get(), 1, "closure must run exactly once on Some");
443

            
444
        assert_eq!(some.and_then(|r| Some(r.magnitude())), Some(5.0));
445
        assert_eq!(
446
            some.and_then(|_| Option::<f32>::None),
447
            None,
448
            "and_then must be able to collapse Some -> None"
449
        );
450
    }
451

            
452
    /// The wrapper is `Copy` — passing it by value across FFI leaves the
453
    /// source usable (and the copy independent).
454
    #[test]
455
    fn option_is_copy_and_the_source_survives() {
456
        let o = OptionSensorReading::Some(accel(0.0, 3.0, 4.0));
457
        let mut copy = o;
458
        copy.replace(accel(1.0, 0.0, 0.0));
459

            
460
        assert_eq!(o.as_option().map(SensorReading::magnitude), Some(5.0));
461
        assert_eq!(copy.as_option().map(SensorReading::magnitude), Some(1.0));
462
    }
463
}
464

            
465
/// The JNI kind codes are the `SensorKind` DISCRIMINANTS, and that contract is
466
/// spelled out in two places that cannot see each other: the `switch` in
467
/// `scripts/android/AzulSensors.java` and `map_kind` in
468
/// `dll/src/desktop/extra/sensors/android.rs`.
469
///
470
/// Reordering or inserting a variant here silently renumbers both. Nothing
471
/// would fail to compile: a barometer's hPa would simply start arriving as a
472
/// step count, in the wrong unit, with no way for anything downstream to
473
/// notice. This test is the only thing standing between that and a release.
474
///
475
/// If it fails, the fix is NOT to update the numbers here - it is to append
476
/// the new variant at the END, which is also what `#[repr(C)]` ABI stability
477
/// already requires.
478
#[test]
479
1
fn the_sensor_kind_discriminants_are_the_jni_wire_codes() {
480
    use crate::sensors::SensorKind;
481
11
    for (kind, code) in [
482
1
        (SensorKind::Accelerometer, 0),
483
1
        (SensorKind::Gyroscope, 1),
484
1
        (SensorKind::Magnetometer, 2),
485
1
        (SensorKind::RotationVector, 3),
486
1
        (SensorKind::Gravity, 4),
487
1
        (SensorKind::LinearAcceleration, 5),
488
1
        (SensorKind::AmbientLight, 6),
489
1
        (SensorKind::Proximity, 7),
490
1
        (SensorKind::Barometer, 8),
491
1
        (SensorKind::StepCounter, 9),
492
1
        (SensorKind::HingeAngle, 10),
493
    ] {
494
11
        assert_eq!(
495
11
            kind as i32, code,
496
            "{kind:?} moved to {}, but AzulSensors.java still sends {code}",
497
            kind as i32
498
        );
499
    }
500
1
}
501

            
502
/// 8e-i-a-i / 8e-i-a-ii: the typed proximity answer.
503
#[cfg(test)]
504
mod proximity_tests {
505
    use super::*;
506

            
507
    #[test]
508
1
    fn a_distance_converts_between_its_units_without_inventing_precision() {
509
1
        let mm = ProximityDistance {
510
1
            value: 250.0,
511
1
            unit: DistanceUnit::Millimeters,
512
1
        };
513
1
        assert_eq!(mm.in_centimeters(), 25.0);
514
1
        assert_eq!(mm.in_meters(), 0.25);
515
1
        let m = ProximityDistance {
516
1
            value: 0.05,
517
1
            unit: DistanceUnit::Meters,
518
1
        };
519
1
        assert_eq!(m.in_millimeters(), 50.0);
520
1
        assert_eq!(m.in_centimeters(), 5.0);
521
1
        let cm = ProximityDistance {
522
1
            value: 3.0,
523
1
            unit: DistanceUnit::Centimeters,
524
1
        };
525
1
        assert_eq!(cm.in_millimeters(), 30.0);
526
1
    }
527

            
528
    /// A binary sensor gives a verdict; a ranging one gives a measurement
529
    /// and no verdict - that is the app's threshold to apply.
530
    #[test]
531
1
    fn only_the_binary_answers_are_verdicts() {
532
1
        assert_eq!(Proximity::Near.is_near(), Some(true));
533
1
        assert_eq!(Proximity::Far.is_near(), Some(false));
534
1
        assert_eq!(
535
1
            Proximity::Distance(ProximityDistance {
536
1
                value: 1.0,
537
1
                unit: DistanceUnit::Centimeters
538
1
            })
539
1
            .is_near(),
540
            None
541
        );
542
1
    }
543
}