mirror of
https://github.com/ktims/rs-aggregate.git
synced 2024-11-15 23:27:18 -08:00
tests: Test against aggregate6 output ordering behaviour
This commit is contained in:
parent
4615a6d769
commit
037f9e9f6e
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
227566
test-data/v4_only/expected
227566
test-data/v4_only/expected
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
39
tests/cli.rs
39
tests/cli.rs
@ -43,14 +43,24 @@ impl Predicate<[u8]> for SortedEquals {
|
|||||||
|
|
||||||
impl PredicateReflection for SortedEquals {}
|
impl PredicateReflection for SortedEquals {}
|
||||||
|
|
||||||
// Really should normalize the data (lex sort) before comparison
|
/// Compare the output with pre-prepared expected outputs. When functionality is
|
||||||
|
/// matching, we generate expected outputs with `aggregate6`, and expect byte-for-byte
|
||||||
|
/// output consistency, including ordering. When our functionality and `aggregate6`'s
|
||||||
|
/// diverge, we generate expected outputs ourselves, and expect output sorted by numeric
|
||||||
|
/// value of the address.
|
||||||
|
///
|
||||||
|
/// Normalization is available for future test cases.
|
||||||
#[rstest]
|
#[rstest]
|
||||||
#[case("test-data/dfz_combined", "")] // Basic aggregation test
|
#[case::dfz_combined("test-data/dfz_combined", "", false)] // Basic aggregation test
|
||||||
#[case("test-data/max_pfxlen", "-m 20")] // Filter on prefix length
|
#[case::max_pfxlen("test-data/max_pfxlen", "-m 20", false)] // Filter on prefix length
|
||||||
#[case("test-data/max_pfxlen_split", "-m 20,32")] // Filter on prefix length (split v4/v6)
|
#[case::max_pfxlen_split("test-data/max_pfxlen_split", "-m 20,32", false)] // Filter on prefix length (split v4/v6)
|
||||||
#[case("test-data/v4_only", "-4")] // Filter v4 only
|
#[case::v4_only("test-data/v4_only", "-4", false)] // Filter v4 only
|
||||||
#[case("test-data/v6_only", "-6")] // Filter v4 only
|
#[case::v6_only("test-data/v6_only", "-6", false)] // Filter v6 only
|
||||||
fn dfz_test(#[case] path: &str, #[case] args: &str) -> Result<(), Box<dyn Error>> {
|
fn dfz_test(
|
||||||
|
#[case] path: &str,
|
||||||
|
#[case] args: &str,
|
||||||
|
#[case] normalize_data: bool,
|
||||||
|
) -> Result<(), Box<dyn Error>> {
|
||||||
let mut cmd = Command::cargo_bin("rs-aggregate")?;
|
let mut cmd = Command::cargo_bin("rs-aggregate")?;
|
||||||
let in_path = Path::new(path).join("input");
|
let in_path = Path::new(path).join("input");
|
||||||
let expect_path = Path::new(path).join("expected");
|
let expect_path = Path::new(path).join("expected");
|
||||||
@ -65,10 +75,17 @@ fn dfz_test(#[case] path: &str, #[case] args: &str) -> Result<(), Box<dyn Error>
|
|||||||
.timeout(std::time::Duration::from_secs(30))
|
.timeout(std::time::Duration::from_secs(30))
|
||||||
.assert();
|
.assert();
|
||||||
|
|
||||||
assert
|
if normalize_data {
|
||||||
.success()
|
assert
|
||||||
.stdout(SortedEquals::new(&expect_data))
|
.success()
|
||||||
.stderr(predicate::str::is_empty());
|
.stdout(SortedEquals::new(&expect_data))
|
||||||
|
.stderr(predicate::str::is_empty());
|
||||||
|
} else {
|
||||||
|
assert
|
||||||
|
.success()
|
||||||
|
.stdout(predicate::eq(expect_data))
|
||||||
|
.stderr(predicate::str::is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user