package scans import "testing" func TestScanProgressBlend(t *testing.T) { const total = 256 if g := scanProgressBlend(0, 0, total); g != 0 { t.Fatalf("0,0 -> 0 got %d", g) } if g := scanProgressBlend(total, total-1, total); g != 99 { t.Fatalf("quick=total full=total-1 -> 99 got %d", g) } if g := scanProgressBlend(total, total, total); g != 100 { t.Fatalf("complete -> 100 got %d", g) } // типичный «застряли на последних SNMP»: ping по всем, SNMP не догнан if g := scanProgressBlend(256, 253, total); g != 99 { t.Fatalf("256,253 -> 99 got %d", g) } }