setup() { load '../../package/kit-busrouter/files/usr/lib/busrouter/lib-score.sh'; }

@test "latency: 5ms scores 100" { run score_latency 5;   [ "$output" -eq 100 ]; }
@test "latency: 200ms scores 0" { run score_latency 200; [ "$output" -eq 0 ]; }
@test "latency clamps below 0" { run score_latency 500;   [ "$output" -eq 0 ]; }
@test "download: 25MB/s scores 100" { run score_download 25; [ "$output" -eq 100 ]; }
@test "download: 0.5MB/s scores 0"  { run score_download 0.5; [ "$output" -eq 0 ]; }
@test "upload: 12.5MB/s scores 100" { run score_upload 12.5; [ "$output" -eq 100 ]; }
@test "upload: 0.5MB/s scores 0"    { run score_upload 0.5;  [ "$output" -eq 0 ]; }
@test "jitter: 1ms scores 100" { run score_jitter 1;  [ "$output" -eq 100 ]; }
@test "jitter: 50ms scores 0"  { run score_jitter 50; [ "$output" -eq 0 ]; }
@test "loss: 0% scores 100" { run score_loss 0;   [ "$output" -eq 100 ]; }
@test "loss: 40% scores 0"  { run score_loss 40;  [ "$output" -eq 0 ]; }
@test "signal: -65dBm scores 100" { run score_signal -65; [ "$output" -eq 100 ]; }
@test "signal: -95dBm scores 0"   { run score_signal -95; [ "$output" -eq 0 ]; }
@test "signal clamps above 100" { run score_signal -50; [ "$output" -eq 100 ]; }
