package main

import "testing"

func TestPercentile(t *testing.T) {
	xs := []float64{3, 1, 2, 100}
	if percentile(xs, .5) != 2 || percentile(xs, 1) != 100 || xs[0] != 3 {
		t.Fatal(xs)
	}
}
func TestUnits(t *testing.T) {
	if 1000*8 != 8000 {
		t.Fatal("byte to bit")
	}
	// Losing one node leaves N-1 nodes; aggregate utilization must fit them.
	n, q, c := 3., 1400., 1000.
	if q/((n-1)*c) != .7 {
		t.Fatal("N-1 calculation")
	}
}
