Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,5 +130,53 @@ mod cli_typed_value_tests;
#[path = "integration/exif_tag_id_collision_tests.rs"]
mod exif_tag_id_collision_tests;

#[path = "integration/error_handling_tests.rs"]
mod error_handling_tests;

// Container / audio format integration tests. These were previously declared
// only in tests/integration/mod.rs, which no Cargo test root ever included, so
// they never compiled. Declare them here like every other integration module.
#[path = "integration/mkv_integration_tests.rs"]
mod mkv_integration_tests;

#[path = "integration/webm_integration_tests.rs"]
mod webm_integration_tests;

#[path = "integration/flv_integration_tests.rs"]
mod flv_integration_tests;

#[path = "integration/avi_integration_tests.rs"]
mod avi_integration_tests;

#[path = "integration/mts_integration_tests.rs"]
mod mts_integration_tests;

#[path = "integration/mp3_integration_tests.rs"]
mod mp3_integration_tests;

#[path = "integration/flac_integration_tests.rs"]
mod flac_integration_tests;

#[path = "integration/aac_integration_tests.rs"]
mod aac_integration_tests;

#[path = "integration/wav_integration_tests.rs"]
mod wav_integration_tests;

#[path = "integration/ogg_integration_tests.rs"]
mod ogg_integration_tests;

#[path = "integration/opus_integration_tests.rs"]
mod opus_integration_tests;

#[path = "integration/ape_integration_tests.rs"]
mod ape_integration_tests;

// No qualcomm/google/microsoft MakerNote test modules: those three suites were
// deleted rather than declared. Every tag name they asserted appears in zero
// ExifTool 13.59 source files, so declaring them would have pinned invented
// data as expected behaviour. See the commit that removed them for the
// name-by-name evidence.

#[path = "forensic/mod.rs"]
mod forensic;
43 changes: 28 additions & 15 deletions tests/integration/aac_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
use oxidex::core::MetadataMap;
use oxidex::core::TagValue;
use oxidex::exiftool_oracle;
use oxidex::io::buffered_reader::BufferedReader;
use oxidex::parsers::audio::aac::parse_aac_metadata;
use serde_json::Value;
use std::path::Path;

/// The value as it reaches output, for the variants these parsers emit.
///
/// Anything else is reported verbatim so a value stored in an unexpected shape
/// fails the comparison instead of quietly reading as equal.
fn printed(value: &TagValue) -> String {
match value {
TagValue::String(s) => s.clone(),
TagValue::Integer(n) => n.to_string(),
TagValue::Float(f) => f.to_string(),
other => format!("<unexpected TagValue variant: {:?}>", other),
}
}

#[test]
#[ignore] // Requires ExifTool to be installed
Expand All @@ -14,10 +30,14 @@ fn test_aac_metadata_parity_with_exiftool() {
}

// Run ExifTool
// -G0 is required: the tags compared below are group-qualified
// ("AAC:SampleRate"), and a plain `-json` emits bare tag names, so every
// lookup would miss and the comparison would silently pass on nothing.
let oracle =
exiftool_oracle::shared().unwrap_or_else(|e| panic!("No usable ExifTool oracle: {e}"));
let exiftool_output = oracle
.command()
.arg("-G0")
.arg("-json")
.arg(test_file)
.output()
Expand All @@ -30,18 +50,15 @@ fn test_aac_metadata_parity_with_exiftool() {

assert!(exiftool_output.status.success(), "ExifTool failed");

let exiftool_json: Vec<Value> = serde_json::from_slice(&exiftool_output.stdout)
.expect("Failed to parse ExifTool JSON");
let exiftool_json: Vec<Value> =
serde_json::from_slice(&exiftool_output.stdout).expect("Failed to parse ExifTool JSON");

// Run OxiDex
let oxidex_metadata = MetadataMap::from_file(test_file)
.expect("Failed to parse AAC file");
let reader = BufferedReader::new(Path::new(test_file)).expect("Failed to open AAC file");
let oxidex_metadata = parse_aac_metadata(&reader).expect("Failed to parse AAC file");

// Compare key tags
let tags_to_compare = [
"AAC:AudioChannels",
"AAC:SampleRate",
];
let tags_to_compare = ["AAC:AudioChannels", "AAC:SampleRate"];

for tag in &tags_to_compare {
let exiftool_value = &exiftool_json[0][tag];
Expand All @@ -51,15 +68,11 @@ fn test_aac_metadata_parity_with_exiftool() {

let oxidex_value = oxidex_metadata.get(tag);

assert!(
oxidex_value.is_some(),
"OxiDex missing tag: {}",
tag
);
assert!(oxidex_value.is_some(), "OxiDex missing tag: {}", tag);

// Compare values (convert to strings for comparison)
let exiftool_str = exiftool_value.to_string().trim_matches('"').to_string();
let oxidex_str = oxidex_value.unwrap().to_string();
let oxidex_str = printed(oxidex_value.unwrap());

assert_eq!(
exiftool_str, oxidex_str,
Expand Down
44 changes: 28 additions & 16 deletions tests/integration/ape_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
use oxidex::core::MetadataMap;
use oxidex::core::TagValue;
use oxidex::exiftool_oracle;
use oxidex::io::buffered_reader::BufferedReader;
use oxidex::parsers::audio::ape::parse_ape_metadata;
use serde_json::Value;
use std::path::Path;

/// The value as it reaches output, for the variants these parsers emit.
///
/// Anything else is reported verbatim so a value stored in an unexpected shape
/// fails the comparison instead of quietly reading as equal.
fn printed(value: &TagValue) -> String {
match value {
TagValue::String(s) => s.clone(),
TagValue::Integer(n) => n.to_string(),
TagValue::Float(f) => f.to_string(),
other => format!("<unexpected TagValue variant: {:?}>", other),
}
}

#[test]
#[ignore] // Requires ExifTool to be installed
Expand All @@ -14,10 +30,14 @@ fn test_ape_metadata_parity_with_exiftool() {
}

// Run ExifTool
// -G0 is required: the tags compared below are group-qualified
// ("APE:CompressionLevel"), and a plain `-json` emits bare tag names, so every
// lookup would miss and the comparison would silently pass on nothing.
let oracle =
exiftool_oracle::shared().unwrap_or_else(|e| panic!("No usable ExifTool oracle: {e}"));
let exiftool_output = oracle
.command()
.arg("-G0")
.arg("-json")
.arg(test_file)
.output()
Expand All @@ -30,19 +50,15 @@ fn test_ape_metadata_parity_with_exiftool() {

assert!(exiftool_output.status.success(), "ExifTool failed");

let exiftool_json: Vec<Value> = serde_json::from_slice(&exiftool_output.stdout)
.expect("Failed to parse ExifTool JSON");
let exiftool_json: Vec<Value> =
serde_json::from_slice(&exiftool_output.stdout).expect("Failed to parse ExifTool JSON");

// Run OxiDex
let oxidex_metadata = MetadataMap::from_file(test_file)
.expect("Failed to parse APE file");
let reader = BufferedReader::new(Path::new(test_file)).expect("Failed to open APE file");
let oxidex_metadata = parse_ape_metadata(&reader).expect("Failed to parse APE file");

// Compare key tags
let tags_to_compare = [
"APE:CompressionLevel",
"APE:SampleRate",
"APE:Channels",
];
let tags_to_compare = ["APE:CompressionLevel", "APE:SampleRate", "APE:Channels"];

for tag in &tags_to_compare {
let exiftool_value = &exiftool_json[0][tag];
Expand All @@ -52,15 +68,11 @@ fn test_ape_metadata_parity_with_exiftool() {

let oxidex_value = oxidex_metadata.get(tag);

assert!(
oxidex_value.is_some(),
"OxiDex missing tag: {}",
tag
);
assert!(oxidex_value.is_some(), "OxiDex missing tag: {}", tag);

// Compare values (convert to strings for comparison)
let exiftool_str = exiftool_value.to_string().trim_matches('"').to_string();
let oxidex_str = oxidex_value.unwrap().to_string();
let oxidex_str = printed(oxidex_value.unwrap());

assert_eq!(
exiftool_str, oxidex_str,
Expand Down
44 changes: 28 additions & 16 deletions tests/integration/avi_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
use oxidex::core::MetadataMap;
use oxidex::core::TagValue;
use oxidex::exiftool_oracle;
use oxidex::io::buffered_reader::BufferedReader;
use oxidex::parsers::video::parse_avi_metadata;
use serde_json::Value;
use std::path::Path;

/// The value as it reaches output, for the variants these parsers emit.
///
/// Anything else is reported verbatim so a value stored in an unexpected shape
/// fails the comparison instead of quietly reading as equal.
fn printed(value: &TagValue) -> String {
match value {
TagValue::String(s) => s.clone(),
TagValue::Integer(n) => n.to_string(),
TagValue::Float(f) => f.to_string(),
other => format!("<unexpected TagValue variant: {:?}>", other),
}
}

#[test]
#[ignore] // Requires ExifTool to be installed
Expand All @@ -14,10 +30,14 @@ fn test_avi_metadata_parity_with_exiftool() {
}

// Run ExifTool
// -G0 is required: the tags compared below are group-qualified
// ("RIFF:FrameRate"), and a plain `-json` emits bare tag names, so every
// lookup would miss and the comparison would silently pass on nothing.
let oracle =
exiftool_oracle::shared().unwrap_or_else(|e| panic!("No usable ExifTool oracle: {e}"));
let exiftool_output = oracle
.command()
.arg("-G0")
.arg("-json")
.arg(test_file)
.output()
Expand All @@ -30,19 +50,15 @@ fn test_avi_metadata_parity_with_exiftool() {

assert!(exiftool_output.status.success(), "ExifTool failed");

let exiftool_json: Vec<Value> = serde_json::from_slice(&exiftool_output.stdout)
.expect("Failed to parse ExifTool JSON");
let exiftool_json: Vec<Value> =
serde_json::from_slice(&exiftool_output.stdout).expect("Failed to parse ExifTool JSON");

// Run OxiDex
let oxidex_metadata = MetadataMap::from_file(test_file)
.expect("Failed to parse AVI file");
let reader = BufferedReader::new(Path::new(test_file)).expect("Failed to open AVI file");
let oxidex_metadata = parse_avi_metadata(&reader).expect("Failed to parse AVI file");

// Compare key tags
let tags_to_compare = [
"RIFF:FrameRate",
"RIFF:ImageWidth",
"RIFF:ImageHeight",
];
let tags_to_compare = ["RIFF:FrameRate", "RIFF:ImageWidth", "RIFF:ImageHeight"];

for tag in &tags_to_compare {
let exiftool_value = &exiftool_json[0][tag];
Expand All @@ -52,15 +68,11 @@ fn test_avi_metadata_parity_with_exiftool() {

let oxidex_value = oxidex_metadata.get(tag);

assert!(
oxidex_value.is_some(),
"OxiDex missing tag: {}",
tag
);
assert!(oxidex_value.is_some(), "OxiDex missing tag: {}", tag);

// Compare values (convert to strings for comparison)
let exiftool_str = exiftool_value.to_string().trim_matches('"').to_string();
let oxidex_str = oxidex_value.unwrap().to_string();
let oxidex_str = printed(oxidex_value.unwrap());

assert_eq!(
exiftool_str, oxidex_str,
Expand Down
Loading
Loading