2020-05-29 07:37:58 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2020-05-29 08:15:33 +00:00
|
|
|
func TestHumanReadableIntsMax(t *testing.T) {
|
|
|
|
assert.Equal(t, "1-2 ...", HumanReadableIntsMax(2, 1, 2, 3))
|
|
|
|
assert.Equal(t, "1 3 ...", HumanReadableIntsMax(2, 1, 3, 5))
|
|
|
|
}
|
|
|
|
|
2020-05-29 07:37:58 +00:00
|
|
|
func TestHumanReadableInts(t *testing.T) {
|
|
|
|
assert.Equal(t, "1-3", HumanReadableInts(1, 2, 3))
|
|
|
|
assert.Equal(t, "1 3", HumanReadableInts(1, 3))
|
|
|
|
assert.Equal(t, "1 3 5", HumanReadableInts(5, 1, 3))
|
|
|
|
assert.Equal(t, "1-3 5", HumanReadableInts(1, 2, 3, 5))
|
|
|
|
assert.Equal(t, "1-3 5 7-9", HumanReadableInts(7, 9, 8, 1, 2, 3, 5))
|
|
|
|
}
|