1use std::collections::HashMap;
81
82use crate::error::LogError;
83use crate::log::{Channel, Event, FlightLog, LogFormat, Quantity, Stated};
84use crate::table::{Notes, finite, numbered_lines, short};
85
86const FORMAT: &str = "AltiMAX Excel export";
87
88const MARKS: [&str; 5] = [
90 "TIME",
91 "PRESS FILTER [hpa]",
92 "HEIGHT FILTER [m]",
93 "PRESS RAW [hpa]",
94 "HEIGHT RAW [m]",
95];
96
97const TIME: &str = "time";
98const HEIGHT_RAW: &str = "height raw [m]";
99const EVENT: &str = "event";
100const VOLT_CHANNEL: &str = "volt. channel";
101const VOLTAGE: &str = "voltage [v]";
102
103const STEP_S: f64 = 0.005;
105
106const PAD_PA: std::ops::RangeInclusive<f64> = 50_000.0..=110_000.0;
108
109const VOLT_CHANNELS: usize = 16;
112
113pub const MAX_COLUMNS: usize = 256;
118
119pub fn recognizes(text: &str) -> bool {
123 numbered_lines(text)
124 .map(|(_, line)| line)
125 .find(|line| !line.trim().is_empty())
126 .is_some_and(|header| {
127 let names: Vec<&str> = header.split(',').map(str::trim).collect();
128 names.len() >= MARKS.len()
129 && MARKS
130 .iter()
131 .zip(&names)
132 .all(|(mark, name)| mark.eq_ignore_ascii_case(name))
133 })
134}
135
136#[derive(Clone, Copy, PartialEq)]
138enum Role {
139 Time,
140 Pressure,
142 Value(Quantity, f64),
143 EventName,
145 Voltage,
147}
148
149fn role(name: &str) -> Role {
150 match name.trim().to_ascii_lowercase().as_str() {
151 TIME => Role::Time,
152 "press filter [hpa]" | "press raw [hpa]" => Role::Pressure,
153 "height filter [m]" | HEIGHT_RAW => Role::Value(Quantity::AltitudeAboveGround, 1.0),
154 "accel [m/s2]" => Role::Value(Quantity::Acceleration, 1.0),
155 "speed [m/s]" => Role::Value(Quantity::Speed, 1.0),
156 EVENT | VOLT_CHANNEL => Role::Value(Quantity::Number, 1.0),
157 VOLTAGE => Role::Voltage,
158 _ => Role::Value(Quantity::Unrecognized, 1.0),
159 }
160}
161
162pub fn read(text: &str) -> Result<FlightLog, LogError> {
174 let text = text.strip_prefix('\u{feff}').unwrap_or(text);
175 if !recognizes(text) {
176 return Err(LogError::NotThisFormat {
177 format: FORMAT,
178 message: format!(
179 "its first line isn't an AltiMAX export's header, which opens `{}`",
180 MARKS.join(",")
181 ),
182 });
183 }
184 let mut lines = numbered_lines(text).filter(|(_, line)| !line.trim().is_empty());
185 let Some((header_line, header)) = lines.next() else {
187 return Err(LogError::NoData { format: FORMAT });
188 };
189 let names: Vec<String> = header
190 .split(',')
191 .take(MAX_COLUMNS + 1)
192 .map(|name| name.trim().to_owned())
193 .collect();
194 if names.len() > MAX_COLUMNS {
195 return Err(syntax(
196 header_line,
197 format!("the header names more than {MAX_COLUMNS} columns"),
198 ));
199 }
200 let mut seen: HashMap<String, usize> = HashMap::new();
205 for name in &names {
206 let same = seen.entry(name.to_ascii_lowercase()).or_insert(0);
207 if *same > usize::from(name.eq_ignore_ascii_case(EVENT)) {
208 return Err(syntax(
209 header_line,
210 format!("the header names {:?} more than once", short(name)),
211 ));
212 }
213 *same += 1;
214 }
215 let mut roles: Vec<Role> = names.iter().map(|name| role(name)).collect();
217 if let Some(second) = names
218 .iter()
219 .enumerate()
220 .filter(|(_, name)| name.eq_ignore_ascii_case(EVENT))
221 .nth(1)
222 .map(|(index, _)| index)
223 {
224 roles[second] = Role::EventName;
225 }
226 let code = names
227 .iter()
228 .position(|name| name.eq_ignore_ascii_case(EVENT));
229 let volt_channel = names
230 .iter()
231 .position(|name| name.eq_ignore_ascii_case(VOLT_CHANNEL));
232 let mut notes = Notes::default();
233 for (name, role) in names.iter().zip(&roles) {
234 if *role == Role::Value(Quantity::Unrecognized, 1.0) {
235 notes.push(format!(
236 "the column {:?} isn't one this reader knows, and was kept as written",
237 short(name)
238 ));
239 }
240 }
241
242 let mut time_s: Vec<f64> = Vec::new();
243 let mut columns: Vec<Vec<f64>> = vec![Vec::new(); names.len()];
244 let mut event_names: Vec<String> = Vec::new();
245 let mut gaps = vec![0usize; names.len()];
246 let mut row_lines: Vec<usize> = Vec::new();
247 for (number, line) in lines {
248 row_lines.push(number);
249 let cells: Vec<&str> = line.split(',').map(str::trim).collect();
250 if cells.len() != names.len() {
251 return Err(syntax(
252 number,
253 format!(
254 "the row has {} cells, and the header names {}",
255 cells.len(),
256 names.len()
257 ),
258 ));
259 }
260 let mut name_cell = String::new();
261 for (index, (cell, role)) in cells.iter().zip(&roles).enumerate() {
262 match role {
263 Role::EventName => (*cell).clone_into(&mut name_cell),
264 Role::Time => {
265 let time = cell.parse::<f64>().ok().filter(|time| time.is_finite());
266 let Some(time) = time else {
267 return Err(syntax(
268 number,
269 format!("the time {:?} isn't a number", short(cell)),
270 ));
271 };
272 if time_s.last().is_some_and(|last| time <= *last) {
273 return Err(syntax(
274 number,
275 format!(
276 "the time {time} doesn't follow the row before it, {}",
277 time_s.last().copied().unwrap_or_default()
278 ),
279 ));
280 }
281 time_s.push(time);
282 }
283 _ => {
284 let value = if cell.is_empty() {
285 gaps[index] += 1;
286 f64::NAN
287 } else {
288 let value = cell.parse::<f64>().ok().filter(|value| !value.is_nan());
289 let value = value.ok_or_else(|| {
290 syntax(
291 number,
292 format!(
293 "{:?}, under {:?}, isn't a number",
294 short(cell),
295 short(&names[index])
296 ),
297 )
298 })?;
299 finite(value, FORMAT, number, &names[index])?
300 };
301 columns[index].push(value);
302 }
303 }
304 }
305 event_names.push(name_cell);
306 }
307 if time_s.is_empty() {
308 return Err(LogError::NoData { format: FORMAT });
309 }
310 clock_in_seconds(&time_s, header_line)?;
311
312 let mut log = FlightLog {
313 format: LogFormat::AltimaxXls,
314 logger: "Rocketronics AltiMAX".to_owned(),
315 serial_number: None,
316 firmware: None,
317 flight_number: None,
318 stated: Stated::default(),
319 time_s: time_s.clone(),
320 altitude_m: Vec::new(),
321 vertical_speed_m_s: None,
322 temperature_k: None,
323 battery_v: None,
324 channels: Vec::new(),
325 events: Vec::new(),
326 notes: Vec::new(),
327 };
328 for (index, role) in roles.iter().enumerate() {
329 let name = &names[index];
330 let values = &columns[index];
331 match role {
332 Role::Time | Role::EventName => {}
333 Role::Pressure => {
334 let scale = pressure_scale(name, values, header_line, &mut notes)?;
335 let values = values
336 .iter()
337 .zip(&row_lines)
338 .map(|(value, line)| finite(value * scale, FORMAT, *line, name))
339 .collect::<Result<Vec<f64>, LogError>>()?;
340 log.channels.push(Channel {
341 column: name.clone(),
342 quantity: Quantity::Pressure,
343 time_s: time_s.clone(),
344 values,
345 });
346 }
347 Role::Value(quantity, scale) => {
348 if name.eq_ignore_ascii_case(HEIGHT_RAW) {
349 log.altitude_m.clone_from(values);
350 }
351 log.channels.push(Channel {
352 column: name.clone(),
353 quantity: *quantity,
354 time_s: time_s.clone(),
355 values: values.iter().map(|value| value * scale).collect(),
356 });
357 }
358 Role::Voltage => {
359 let numbers = volt_channel.map(|at| columns[at].as_slice());
360 split_voltages(&mut log, name, values, numbers, header_line)?;
361 }
362 }
363 }
364 if log.altitude_m.is_empty() {
365 return Err(syntax(
366 header_line,
367 "the header names no `HEIGHT RAW [m]`, the altitude above the pad".to_owned(),
368 ));
369 }
370 if let Some(code) = code {
371 for ((time, code), name) in time_s.iter().zip(&columns[code]).zip(&event_names) {
372 if *code != 0.0 && !code.is_nan() {
373 log.events.push(Event {
374 time_s: *time,
375 name: name.clone(),
376 });
377 }
378 }
379 }
380 for (index, count) in gaps.iter().enumerate() {
381 if *count > 0 {
382 notes.push(format!(
383 "the column {:?} holds {count} empty cells: they are gaps",
384 short(&names[index])
385 ));
386 }
387 }
388 notes.push(format!(
389 "`TIME` names no unit; read in seconds, its shortest step {STEP_S} s, the 200 samples a \
390 second the maker's manual gives"
391 ));
392 log.notes = notes.into_vec();
393 Ok(log)
394}
395
396fn split_voltages(
400 log: &mut FlightLog,
401 name: &str,
402 values: &[f64],
403 channels: Option<&[f64]>,
404 header_line: usize,
405) -> Result<(), LogError> {
406 let Some(channels) = channels else {
407 log.channels.push(Channel {
408 column: name.to_owned(),
409 quantity: Quantity::Voltage,
410 time_s: log.time_s.clone(),
411 values: values.to_vec(),
412 });
413 return Ok(());
414 };
415 let mut rows: Vec<(f64, usize)> = channels
417 .iter()
418 .enumerate()
419 .filter(|(_, number)| number.is_finite())
420 .map(|(row, number)| (number + 0.0, row))
421 .collect();
422 rows.sort_by(|a, b| a.0.total_cmp(&b.0).then(a.1.cmp(&b.1)));
423 let groups: Vec<&[(f64, usize)]> = rows.chunk_by(|a, b| a.0 == b.0).collect();
424 if groups.len() > VOLT_CHANNELS {
425 return Err(syntax(
426 header_line,
427 format!(
428 "`VOLT. CHANNEL` holds {} channel numbers, more than the {VOLT_CHANNELS} this \
429 reader takes",
430 groups.len()
431 ),
432 ));
433 }
434 for group in groups {
435 let number = group[0].0;
437 log.channels.push(Channel {
438 column: format!("{name} (channel {number})"),
439 quantity: Quantity::Voltage,
440 time_s: group.iter().map(|(_, row)| log.time_s[*row]).collect(),
441 values: group.iter().map(|(_, row)| values[*row]).collect(),
442 });
443 }
444 Ok(())
445}
446
447fn clock_in_seconds(time_s: &[f64], header_line: usize) -> Result<(), LogError> {
450 let shortest = time_s
451 .windows(2)
452 .map(|pair| pair[1] - pair[0])
453 .fold(f64::INFINITY, f64::min);
454 if time_s.len() < 2 {
455 return Err(LogError::Unit {
456 format: FORMAT,
457 line: header_line,
458 message: "`TIME` names no unit, and with one row it has no step to tell it by"
459 .to_owned(),
460 });
461 }
462 if (shortest - STEP_S).abs() <= 0.1 * STEP_S {
463 return Ok(());
464 }
465 Err(LogError::Unit {
466 format: FORMAT,
467 line: header_line,
468 message: format!(
469 "`TIME` names no unit, and its shortest step, {shortest}, isn't the 5 ms of the 200 \
470 samples a second the altimeter stores, read in seconds"
471 ),
472 })
473}
474
475fn pressure_scale(
478 name: &str,
479 values: &[f64],
480 header_line: usize,
481 notes: &mut Notes,
482) -> Result<f64, LogError> {
483 let Some(first) = values.iter().copied().find(|value| value.is_finite()) else {
484 return Ok(100.0);
485 };
486 if PAD_PA.contains(&(first * 100.0)) {
487 Ok(100.0)
488 } else if PAD_PA.contains(&first) {
489 notes.push(format!(
490 "the column {:?} says hPa, but its values are pascals. Its first, on the pad, lies \
491 between 500 and 1,100 hPa only when read in Pa, and was read so",
492 short(name)
493 ));
494 Ok(1.0)
495 } else {
496 Err(LogError::Unit {
497 format: FORMAT,
498 line: header_line,
499 message: format!(
500 "the column {:?}'s first value, {first}, is a pad's pressure in neither hPa nor \
501 Pa: neither puts it between 500 and 1,100 hPa",
502 short(name)
503 ),
504 })
505 }
506}
507
508fn syntax(line: usize, message: String) -> LogError {
509 LogError::Syntax {
510 format: FORMAT,
511 line,
512 message,
513 }
514}
515
516#[cfg(test)]
517mod tests {
518 use super::*;
519
520 const HEADER: &str = "TIME,PRESS FILTER [hpa],HEIGHT FILTER [m],PRESS RAW [hpa],HEIGHT RAW [m],\
521 ACCEL [m/s2],SPEED [m/s],EVENT,EVENT,VOLT. CHANNEL,VOLTAGE [V]";
522
523 fn export(rows: &[(f64, f64, f64, u32, &str, u32, f64)]) -> String {
526 let mut text = format!("{HEADER}\n");
527 for (time, pressure, height, code, event, channel, volts) in rows {
528 text.push_str(&format!(
529 "{time},{pressure},{height},{pressure},{height},-9.8,0,{code},{event},{channel},\
530 {volts}\n"
531 ));
532 }
533 text
534 }
535
536 fn sample() -> String {
537 export(&[
538 (0.005, 98_000.0, 0.0, 0, "PAD", 1, 7.4),
539 (0.010, 97_990.0, 0.9, 3, "BARO-LIFTOFF", 2, 7.3),
540 (0.015, 97_975.0, 2.2, 0, "PAD", 1, 7.39),
541 (0.040, 97_950.0, 4.3, 9, "APOGEE PRESSURE", 2, 7.29),
542 ])
543 }
544
545 fn channel<'a>(log: &'a FlightLog, column: &str) -> &'a Channel {
546 log.channels
547 .iter()
548 .find(|channel| channel.column == column)
549 .unwrap_or_else(|| panic!("no channel {column}"))
550 }
551
552 #[test]
553 fn an_export_reads_with_its_events_and_voltages() {
554 let log = read(&sample()).unwrap();
555 assert_eq!(log.format, LogFormat::AltimaxXls);
556 assert_eq!(log.time_s, [0.005, 0.01, 0.015, 0.04]);
557 assert_eq!(log.altitude_m, [0.0, 0.9, 2.2, 4.3]);
558 let names: Vec<(f64, &str)> = log
559 .events
560 .iter()
561 .map(|event| (event.time_s, event.name.as_str()))
562 .collect();
563 assert_eq!(names, [(0.01, "BARO-LIFTOFF"), (0.04, "APOGEE PRESSURE")]);
564 let first = channel(&log, "VOLTAGE [V] (channel 1)");
566 assert_eq!(
567 (first.time_s.as_slice(), first.values.as_slice()),
568 (&[0.005, 0.015][..], &[7.4, 7.39][..])
569 );
570 let second = channel(&log, "VOLTAGE [V] (channel 2)");
571 assert_eq!(second.values, [7.3, 7.29]);
572 assert_eq!(channel(&log, "EVENT").values, [0.0, 3.0, 0.0, 9.0]);
573 assert_eq!(
574 channel(&log, "HEIGHT FILTER [m]").quantity,
575 Quantity::AltitudeAboveGround
576 );
577 assert_eq!(log.vertical_speed_m_s, None);
578 }
579
580 #[test]
581 fn a_pressure_is_read_in_the_unit_that_puts_the_pad_in_its_band() {
582 let log = read(&sample()).unwrap();
584 assert_eq!(channel(&log, "PRESS RAW [hpa]").values[0], 98_000.0);
585 assert!(
586 log.notes
587 .iter()
588 .any(|note| note.contains("says hPa, but its values are pascals"))
589 );
590 let hpa = export(&[
592 (0.005, 980.0, 0.0, 0, "PAD", 1, 7.4),
593 (0.01, 979.9, 0.9, 0, "PAD", 2, 7.3),
594 ]);
595 let log = read(&hpa).unwrap();
596 assert_eq!(channel(&log, "PRESS RAW [hpa]").values[0], 98_000.0);
597 assert!(!log.notes.iter().any(|note| note.contains("says hPa")));
598 for (first, pascals) in [
600 (500.0, 50_000.0),
601 (1_100.0, 110_000.0),
602 (50_000.0, 50_000.0),
603 (110_000.0, 110_000.0),
604 ] {
605 let text = export(&[
606 (0.005, first, 0.0, 0, "PAD", 1, 7.4),
607 (0.01, first, 0.0, 0, "PAD", 1, 7.4),
608 ]);
609 assert_eq!(
610 channel(&read(&text).unwrap(), "PRESS RAW [hpa]").values[0],
611 pascals
612 );
613 }
614 for first in [499.9, 1_100.1, 49_999.0, 110_001.0, 5_000.0] {
615 let text = export(&[
616 (0.005, first, 0.0, 0, "PAD", 1, 7.4),
617 (0.01, first, 0.0, 0, "PAD", 1, 7.4),
618 ]);
619 match read(&text) {
620 Err(LogError::Unit { message, .. }) => {
621 assert!(message.contains("neither hPa nor Pa"), "{message}");
622 }
623 other => panic!("{first}: expected a unit refusal, got {other:?}"),
624 }
625 }
626 }
627
628 #[test]
629 fn the_clock_is_read_in_seconds_only_at_the_altimeters_rate() {
630 let ms = export(&[
632 (5.0, 98_000.0, 0.0, 0, "PAD", 1, 7.4),
633 (10.0, 97_990.0, 0.9, 0, "PAD", 2, 7.3),
634 ]);
635 match read(&ms) {
636 Err(LogError::Unit { message, .. }) => assert!(message.contains("5 ms"), "{message}"),
637 other => panic!("expected a unit refusal, got {other:?}"),
638 }
639 for (step, reads) in [
641 (0.004_51, true),
642 (0.005_49, true),
643 (0.004_49, false),
644 (0.005_51, false),
645 ] {
646 let text = export(&[
647 (1.0, 98_000.0, 0.0, 0, "PAD", 1, 7.4),
648 (1.0 + step, 97_990.0, 0.9, 0, "PAD", 2, 7.3),
649 ]);
650 assert_eq!(read(&text).is_ok(), reads, "step {step}");
651 }
652 }
653
654 #[test]
655 fn a_broken_row_is_refused_on_its_line() {
656 let mut text = sample();
657 text.push_str("0.03,1,2\n");
658 match read(&text) {
659 Err(LogError::Syntax { line, message, .. }) => {
660 assert_eq!(line, 6);
661 assert!(
662 message.contains("has 3 cells, and the header names 11"),
663 "{message}"
664 );
665 }
666 other => panic!("expected a syntax refusal, got {other:?}"),
667 }
668 let back = export(&[
669 (0.01, 98_000.0, 0.0, 0, "PAD", 1, 7.4),
670 (0.005, 97_990.0, 0.9, 0, "PAD", 2, 7.3),
671 ]);
672 assert!(matches!(read(&back), Err(LogError::Syntax { line: 3, .. })));
673 let word = sample().replace("-9.8", "x");
674 assert!(matches!(read(&word), Err(LogError::Syntax { line: 2, .. })));
675 }
676
677 fn refused(text: &str) -> (usize, String) {
679 match read(text) {
680 Err(LogError::Syntax { line, message, .. } | LogError::Unit { line, message, .. }) => {
681 (line, message)
682 }
683 other => panic!("expected a refusal, got {other:?}"),
684 }
685 }
686
687 #[test]
689 fn a_name_twice_in_another_case_or_event_thrice_is_refused() {
690 for (from, to) in [("ACCEL [m/s2]", "time"), ("VOLTAGE [V]", "event")] {
691 let (line, message) = refused(&sample().replacen(from, to, 1));
692 assert_eq!(line, 1, "{to}");
693 assert!(
694 message.contains(&format!("names {to:?} more than once")),
695 "{to}: {message}"
696 );
697 }
698 }
699
700 #[test]
705 #[allow(clippy::disallowed_types, reason = "the clock times this test alone")]
706 fn a_header_wider_than_the_limit_is_refused_at_once() {
707 let widened = |extra: usize| {
708 let names: String = (0..extra).map(|k| format!(",X{k}")).collect();
709 let cells = ",0".repeat(extra);
710 sample()
711 .lines()
712 .enumerate()
713 .map(|(index, line)| {
714 let added = if index == 0 {
715 names.as_str()
716 } else {
717 cells.as_str()
718 };
719 format!("{line}{added}\n")
720 })
721 .collect::<String>()
722 };
723 let known = HEADER.split(',').count();
724 assert!(read(&widened(MAX_COLUMNS - known)).is_ok());
725 let (line, message) = refused(&widened(MAX_COLUMNS + 1 - known));
726 assert_eq!(line, 1);
727 assert!(
728 message.contains(&format!("more than {MAX_COLUMNS} columns")),
729 "{message}"
730 );
731 let wide = widened(1_000_000);
732 let began = std::time::Instant::now();
733 let (_, message) = refused(&wide);
734 let elapsed = began.elapsed();
735 assert!(
736 message.contains(&format!("more than {MAX_COLUMNS} columns")),
737 "{message}"
738 );
739 assert!(elapsed.as_secs_f64() < 5.0, "{elapsed:?}");
740 }
741
742 #[test]
745 fn a_column_named_twice_is_refused_but_event() {
746 for (from, to) in [
747 ("ACCEL [m/s2]", "TIME"),
748 ("SPEED [m/s]", "HEIGHT RAW [m]"),
749 ("VOLTAGE [V]", "EVENT"),
750 ] {
751 let (line, message) = refused(&sample().replacen(from, to, 1));
752 assert_eq!(line, 1, "{to}");
753 assert!(
754 message.contains(&format!("names {to:?} more than once")),
755 "{to}: {message}"
756 );
757 }
758 }
759
760 #[test]
763 fn a_value_that_isnt_a_finite_number_is_refused_on_its_line() {
764 let (line, message) = refused(&sample().replacen(",-9.8,", ",NaN,", 1));
765 assert_eq!(line, 2);
766 assert!(
767 message.contains("\"NaN\", under \"ACCEL [m/s2]\", isn't a number"),
768 "{message}"
769 );
770 let huge = export(&[
771 (0.005, 980.0, 0.0, 0, "PAD", 1, 7.4),
772 (0.010, 1e307, 0.9, 0, "PAD", 2, 7.3),
773 ]);
774 let (line, message) = refused(&huge);
775 assert_eq!(line, 3);
776 assert!(message.contains("too large"), "{message}");
777 }
778
779 #[test]
781 fn more_than_16_voltage_channels_are_refused() {
782 let rows = |count: u32| {
783 export(
784 &(0..count)
785 .map(|n| (0.005 * f64::from(n + 1), 98_000.0, 0.0, 0, "PAD", n, 7.0))
786 .collect::<Vec<_>>(),
787 )
788 };
789 let log = read(&rows(16)).unwrap();
790 let voltages = log
791 .channels
792 .iter()
793 .filter(|channel| channel.quantity == Quantity::Voltage);
794 assert_eq!(voltages.count(), 16);
795 let (line, message) = refused(&rows(17));
796 assert_eq!(line, 1);
797 assert!(message.contains("17 channel numbers"), "{message}");
798 }
799
800 #[test]
801 fn a_clock_of_one_row_is_refused() {
802 let (_, message) = refused(&export(&[(0.005, 98_000.0, 0.0, 0, "PAD", 1, 7.4)]));
803 assert!(message.contains("one row"), "{message}");
804 }
805
806 #[test]
807 fn an_empty_cell_is_a_gap_counted_in_a_note() {
808 let text = sample().replacen(",-9.8,", ",,", 1);
809 let log = read(&text).unwrap();
810 assert!(channel(&log, "ACCEL [m/s2]").values[0].is_nan());
811 assert!(
812 log.notes
813 .iter()
814 .any(|note| note.contains("\"ACCEL [m/s2]\" holds 1 empty cells"))
815 );
816 }
817
818 #[test]
819 fn the_layout_is_told_by_its_first_five_columns() {
820 assert!(recognizes(&sample()));
821 assert!(recognizes(&sample().to_ascii_lowercase()));
822 assert!(!recognizes(
823 "TIME,PRESS FILTER [hpa],HEIGHT FILTER [m],PRESS RAW [hpa]\n"
824 ));
825 assert!(!recognizes("Time,Altitude\n0,0\n"));
826 assert!(matches!(
827 read("Time,Altitude\n0,0\n"),
828 Err(LogError::NotThisFormat { .. })
829 ));
830 assert!(matches!(
831 read(&format!("{HEADER}\n")),
832 Err(LogError::NoData { .. })
833 ));
834 }
835}