Don't format zero bandwidth as "unlimited".

This commit is contained in:
Joachim Bauch 2025-11-18 15:35:06 +01:00
commit dca35b46d4
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02
3 changed files with 12 additions and 6 deletions

View file

@ -56,10 +56,8 @@ func (b Bandwidth) String() string {
return formatWithRemainder(b.Bits(), Megabit.Bits(), "Mbps")
} else if b >= Kilobit {
return formatWithRemainder(b.Bits(), Kilobit.Bits(), "Kbps")
} else if b > 0 {
return fmt.Sprintf("%d bps", b)
} else {
return "unlimited"
return fmt.Sprintf("%d bps", b)
}
}

View file

@ -67,7 +67,7 @@ func TestBandwidthString(t *testing.T) {
}{
{
0,
"unlimited",
"0 bps",
},
{
BandwidthFromBits(123),