logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

seq.sh (1486B)


  1. #!/bin/sh
  2. # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. # SPDX-License-Identifier: MPL-2.0
  4. WD="$(dirname "$0")/../"
  5. target="${WD}/cmd/seq"
  6. plans=27
  7. . "${WD}/test-cmd/tap.sh"
  8. # One arg
  9. t_args 1 '1' -s, -t '' 1
  10. t_args 5 '1,2,3,4,5' -s, -t '' 5
  11. t_args n1 '1,0,-1' -s, -t '' -- -1
  12. t_args n5 '1,0,-1,-2,-3,-4,-5' -s, -t '' -- -5
  13. # Two args
  14. t_args 0_1 '0,1' -s, -t '' 0 1
  15. t_args 0_5 '0,1,2,3,4,5' -s, -t '' 0 5
  16. t_args 10_15 '10,11,12,13,14,15' -s, -t '' 10 15
  17. t_args 2_n2 '2,1,0,-1,-2' -s, -t '' 2 -2
  18. t_args n2_2 '-2,-1,0,1,2' -s, -t '' -- -2 2
  19. # Three args
  20. t_args 0_1_1 '0,1' -s, -t '' 0 1 1
  21. t_args 0_1_5 '0,1,2,3,4,5' -s, -t '' 0 1 5
  22. t_args 10_1_15 '10,11,12,13,14,15' -s, -t '' 10 1 15
  23. t_args 0_2_5 '0,2,4' -s, -t '' 0 2 5
  24. t_args 10_2_15 '10,12,14' -s, -t '' 10 2 15
  25. t_args 0_1_n1 '0,-1' -s, -t '' 0 1 -1
  26. t_args 0_1_n5 '0,-1,-2,-3,-4,-5' -s, -t '' 0 1 -5
  27. t_args n10_1_n15 '-10,-11,-12,-13,-14,-15' -s, -t '' -- -10 1 -15
  28. t_args 0_n1_n1 '0,-1' -s, -t '' 0 -1 -1
  29. t_args 0_2_n5 '0,-2,-4' -s, -t '' 0 2 -5
  30. t_args n10_2_n15 '-10,-12,-14' -s, -t '' -- -10 2 -15
  31. # == constant width ==
  32. t_args w:1 '1' -s, -t '' -w 1
  33. t_args w:5 '01,00,-1,-2,-3,-4,-5' -s, -t '' -w -- -5
  34. # -w two args
  35. t_args w:0_5 '0,1,2,3,4,5' -s, -t '' -w 0 5
  36. t_args w:2_n2 '02,01,00,-1,-2' -s, -t '' -w 2 -2
  37. # -w three args
  38. t_args w:0_1_5 '0,1,2,3,4,5' -s, -t '' -w 0 1 5
  39. t_args w:0_2_n5 '00,-2,-4' -s, -t '' -w 0 2 -5
  40. t_args w:n10_2_n15 '-10,-12,-14' -s, -t '' -w -- -10 2 -15