inits_test.go 575 B

12345678910111213141516171819
  1. package util
  2. import (
  3. "github.com/stretchr/testify/assert"
  4. "testing"
  5. )
  6. func TestHumanReadableIntsMax(t *testing.T) {
  7. assert.Equal(t, "1-2 ...", HumanReadableIntsMax(2, 1, 2, 3))
  8. assert.Equal(t, "1 3 ...", HumanReadableIntsMax(2, 1, 3, 5))
  9. }
  10. func TestHumanReadableInts(t *testing.T) {
  11. assert.Equal(t, "1-3", HumanReadableInts(1, 2, 3))
  12. assert.Equal(t, "1 3", HumanReadableInts(1, 3))
  13. assert.Equal(t, "1 3 5", HumanReadableInts(5, 1, 3))
  14. assert.Equal(t, "1-3 5", HumanReadableInts(1, 2, 3, 5))
  15. assert.Equal(t, "1-3 5 7-9", HumanReadableInts(7, 9, 8, 1, 2, 3, 5))
  16. }