mirror of
https://github.com/maciejpedzich/f1-game-packet-parser.git
synced 2025-04-04 13:21:14 +02:00
test: add integration tests for the parse function
This commit is contained in:
parent
da61459142
commit
7a374cbde7
@ -45,7 +45,7 @@
|
||||
//! differentiate between all packet types and extract their payloads.
|
||||
//! Of course, you can remove the branches you don't need.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! ```ignore
|
||||
//! use f1_game_packet_parser::parse;
|
||||
//!
|
||||
//! let placeholder_data = include_bytes!("placeholder.bin");
|
||||
@ -99,7 +99,7 @@
|
||||
//! You can import the enum and use a matcher to determine an event's type
|
||||
//! and extract its payload (if available) like so:
|
||||
//!
|
||||
//! ```no_run
|
||||
//! ```ignore
|
||||
//! use f1_game_packet_parser::packets::event::EventDetails;
|
||||
//! use f1_game_packet_parser::parse;
|
||||
//!
|
||||
@ -146,7 +146,7 @@
|
||||
//! and determine whether the revs are high, medium or low
|
||||
//! based on the specific bit values being set.
|
||||
//!
|
||||
//! ```no_run
|
||||
//! ```ignore
|
||||
//! use f1_game_packet_parser::constants::RevLights;
|
||||
//! use f1_game_packet_parser::parse;
|
||||
//!
|
||||
@ -245,7 +245,7 @@ use serde::{Deserialize, Serialize};
|
||||
///
|
||||
/// assert!(parse_result.is_err());
|
||||
/// assert_eq!(
|
||||
/// parse_result.unwrap_err().to_string(),
|
||||
/// parse_result.unwrap_err().root_cause().to_string(),
|
||||
/// "Invalid or unsupported packet format: 2137 at 0x0"
|
||||
/// );
|
||||
/// ```
|
||||
|
570
tests/parse.rs
570
tests/parse.rs
@ -1 +1,571 @@
|
||||
use f1_game_packet_parser::parse;
|
||||
|
||||
#[test]
|
||||
fn parse_2022_0() {
|
||||
let data = include_bytes!("data/2022-00.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_1() {
|
||||
let data = include_bytes!("data/2022-01.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_2() {
|
||||
let data = include_bytes!("data/2022-02.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_butn() {
|
||||
let data = include_bytes!("data/2022-03-BUTN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_chqf() {
|
||||
let data = include_bytes!("data/2022-03-CHQF.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_drsd() {
|
||||
let data = include_bytes!("data/2022-03-DRSD.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_drse() {
|
||||
let data = include_bytes!("data/2022-03-DRSE.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_dtsv() {
|
||||
let data = include_bytes!("data/2022-03-DTSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_flbk() {
|
||||
let data = include_bytes!("data/2022-03-FLBK.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_ftlp() {
|
||||
let data = include_bytes!("data/2022-03-FTLP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_lgot() {
|
||||
let data = include_bytes!("data/2022-03-LGOT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_pena() {
|
||||
let data = include_bytes!("data/2022-03-PENA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_rcwn() {
|
||||
let data = include_bytes!("data/2022-03-RCWN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_rtmt() {
|
||||
let data = include_bytes!("data/2022-03-RTMT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_send() {
|
||||
let data = include_bytes!("data/2022-03-SEND.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_sgsv() {
|
||||
let data = include_bytes!("data/2022-03-SGSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_sptp() {
|
||||
let data = include_bytes!("data/2022-03-SPTP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_ssta() {
|
||||
let data = include_bytes!("data/2022-03-SSTA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_stlg() {
|
||||
let data = include_bytes!("data/2022-03-STLG.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_3_tmpt() {
|
||||
let data = include_bytes!("data/2022-03-TMPT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_4() {
|
||||
let data = include_bytes!("data/2022-04.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_5() {
|
||||
let data = include_bytes!("data/2022-05.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_6() {
|
||||
let data = include_bytes!("data/2022-06.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_7() {
|
||||
let data = include_bytes!("data/2022-07.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_8() {
|
||||
let data = include_bytes!("data/2022-08.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_9() {
|
||||
let data = include_bytes!("data/2022-09.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_10() {
|
||||
let data = include_bytes!("data/2022-10.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2022_11() {
|
||||
let data = include_bytes!("data/2022-11.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_0() {
|
||||
let data = include_bytes!("data/2022-00.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_1() {
|
||||
let data = include_bytes!("data/2022-01.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_2() {
|
||||
let data = include_bytes!("data/2022-02.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_butn() {
|
||||
let data = include_bytes!("data/2023-03-BUTN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_chqf() {
|
||||
let data = include_bytes!("data/2023-03-CHQF.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_drsd() {
|
||||
let data = include_bytes!("data/2023-03-DRSD.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_drse() {
|
||||
let data = include_bytes!("data/2023-03-DRSE.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_dtsv() {
|
||||
let data = include_bytes!("data/2023-03-DTSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_flbk() {
|
||||
let data = include_bytes!("data/2023-03-FLBK.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_ftlp() {
|
||||
let data = include_bytes!("data/2023-03-FTLP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_lgot() {
|
||||
let data = include_bytes!("data/2023-03-LGOT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_ovtk() {
|
||||
let data = include_bytes!("data/2023-03-OVTK.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_pena() {
|
||||
let data = include_bytes!("data/2023-03-PENA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_rcwn() {
|
||||
let data = include_bytes!("data/2023-03-RCWN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_rdfl() {
|
||||
let data = include_bytes!("data/2023-03-RDFL.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_rtmt() {
|
||||
let data = include_bytes!("data/2023-03-RTMT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_send() {
|
||||
let data = include_bytes!("data/2023-03-SEND.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_sgsv() {
|
||||
let data = include_bytes!("data/2023-03-SGSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_sptp() {
|
||||
let data = include_bytes!("data/2023-03-SPTP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_ssta() {
|
||||
let data = include_bytes!("data/2023-03-SSTA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_stlg() {
|
||||
let data = include_bytes!("data/2023-03-STLG.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_3_tmpt() {
|
||||
let data = include_bytes!("data/2023-03-TMPT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_4() {
|
||||
let data = include_bytes!("data/2023-04.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_5() {
|
||||
let data = include_bytes!("data/2023-05.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_6() {
|
||||
let data = include_bytes!("data/2023-06.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_7() {
|
||||
let data = include_bytes!("data/2023-07.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_8() {
|
||||
let data = include_bytes!("data/2023-08.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_9() {
|
||||
let data = include_bytes!("data/2023-09.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_10() {
|
||||
let data = include_bytes!("data/2023-10.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_11() {
|
||||
let data = include_bytes!("data/2023-11.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_12() {
|
||||
let data = include_bytes!("data/2023-12.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2023_13() {
|
||||
let data = include_bytes!("data/2023-13.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_0() {
|
||||
let data = include_bytes!("data/2022-00.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_1() {
|
||||
let data = include_bytes!("data/2022-01.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_2() {
|
||||
let data = include_bytes!("data/2022-02.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_butn() {
|
||||
let data = include_bytes!("data/2024-03-BUTN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_chqf() {
|
||||
let data = include_bytes!("data/2024-03-CHQF.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_coll() {
|
||||
let data = include_bytes!("data/2024-03-COLL.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_drsd() {
|
||||
let data = include_bytes!("data/2024-03-DRSD.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_drse() {
|
||||
let data = include_bytes!("data/2024-03-DRSE.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_dtsv() {
|
||||
let data = include_bytes!("data/2024-03-DTSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_flbk() {
|
||||
let data = include_bytes!("data/2024-03-FLBK.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_ftlp() {
|
||||
let data = include_bytes!("data/2024-03-FTLP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_lgot() {
|
||||
let data = include_bytes!("data/2024-03-LGOT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_ovtk() {
|
||||
let data = include_bytes!("data/2024-03-OVTK.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_pena() {
|
||||
let data = include_bytes!("data/2024-03-PENA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_rcwn() {
|
||||
let data = include_bytes!("data/2024-03-RCWN.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_rdfl() {
|
||||
let data = include_bytes!("data/2024-03-RDFL.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_rtmt() {
|
||||
let data = include_bytes!("data/2024-03-RTMT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_scar() {
|
||||
let data = include_bytes!("data/2024-03-SCAR.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_send() {
|
||||
let data = include_bytes!("data/2024-03-SEND.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_sgsv() {
|
||||
let data = include_bytes!("data/2024-03-SGSV.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_sptp() {
|
||||
let data = include_bytes!("data/2024-03-SPTP.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_ssta() {
|
||||
let data = include_bytes!("data/2024-03-SSTA.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_stlg() {
|
||||
let data = include_bytes!("data/2024-03-STLG.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_3_tmpt() {
|
||||
let data = include_bytes!("data/2024-03-TMPT.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_4() {
|
||||
let data = include_bytes!("data/2024-04.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_5() {
|
||||
let data = include_bytes!("data/2024-05.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_6() {
|
||||
let data = include_bytes!("data/2024-06.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_7() {
|
||||
let data = include_bytes!("data/2024-07.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_8() {
|
||||
let data = include_bytes!("data/2024-08.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_9() {
|
||||
let data = include_bytes!("data/2024-09.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_10() {
|
||||
let data = include_bytes!("data/2024-10.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_11() {
|
||||
let data = include_bytes!("data/2024-11.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_12() {
|
||||
let data = include_bytes!("data/2024-12.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_13() {
|
||||
let data = include_bytes!("data/2024-13.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_2024_14() {
|
||||
let data = include_bytes!("data/2024-14.bin");
|
||||
assert!(parse(data).is_ok());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user