FIXTURES="$BATS_TEST_DIRNAME/../../tests/fixtures"
setup() { load '../../package/kit-busrouter/files/usr/lib/busrouter/metrics-net.sh'; }

@test "net: zero-jitter no-loss" {
    run _net_parse_ping < "$FIXTURES/ping-ok.txt"
    [ "$status" -eq 0 ]
    [ "$output" = "15.0 0.0 0" ]
}
@test "net: jitter and packet loss" {
    run _net_parse_ping < "$FIXTURES/ping-loss.txt"
    [ "$output" = "15.0 5.0 20" ]
}
@test "net: 100pct loss gives 0 0 100" {
    run _net_parse_ping < "$FIXTURES/ping-timeout.txt"
    [ "$output" = "0 0 100" ]
}
@test "net: partial output defaults loss to 100" {
    run _net_parse_ping < "$FIXTURES/ping-partial.txt"
    [ "$output" = "20.0 0.0 100" ]
}
