seq (3146B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
- # SPDX-License-Identifier: MPL-2.0
- atf_test_case one
- one_body() {
- atf_check -o "inline:1\n" ../cmd/seq 1
- atf_check -o "inline:1\n2\n3\n4\n5\n" ../cmd/seq 5
- atf_check -o "inline:1\n0\n-1\n" -- ../cmd/seq -- -1
- atf_check -o "inline:1\n0\n-1\n-2\n-3\n-4\n-5\n" -- ../cmd/seq -- -5
- }
- atf_test_case two
- two_body() {
- atf_check -o "inline:0\n1\n" ../cmd/seq 0 1
- atf_check -o "inline:0\n1\n2\n3\n4\n5\n" ../cmd/seq 0 5
- atf_check -o "inline:10\n11\n12\n13\n14\n15\n" ../cmd/seq 10 15
- atf_check -o "inline:0\n-1\n" -- ../cmd/seq 0 -1
- atf_check -o "inline:0\n-1\n-2\n-3\n-4\n-5\n" -- ../cmd/seq 0 -5
- atf_check -o "inline:-10\n-11\n-12\n-13\n-14\n-15\n" -- ../cmd/seq -- -10 -15
- atf_check -o "inline:2\n1\n0\n-1\n-2\n" -- ../cmd/seq 2 -2
- atf_check -o "inline:-2\n-1\n0\n1\n2\n" -- ../cmd/seq -- -2 2
- }
- atf_test_case three
- three_body() {
- atf_check -o "inline:0\n1\n" ../cmd/seq 0 1 1
- atf_check -o "inline:0\n1\n2\n3\n4\n5\n" ../cmd/seq 0 1 5
- atf_check -o "inline:10\n11\n12\n13\n14\n15\n" ../cmd/seq 10 1 15
- atf_check -o "inline:0\n2\n4\n" ../cmd/seq 0 2 5
- atf_check -o "inline:10\n12\n14\n" ../cmd/seq 10 2 15
- atf_check -o "inline:0\n-1\n" -- ../cmd/seq 0 1 -1
- atf_check -o "inline:0\n-1\n-2\n-3\n-4\n-5\n" -- ../cmd/seq 0 1 -5
- atf_check -o "inline:-10\n-11\n-12\n-13\n-14\n-15\n" -- ../cmd/seq -- -10 1 -15
- atf_check -o "inline:0\n-1\n" -- ../cmd/seq 0 -1 -1
- atf_check -o "inline:0\n-2\n-4\n" -- ../cmd/seq 0 2 -5
- atf_check -o "inline:-10\n-12\n-14\n" -- ../cmd/seq -- -10 2 -15
- }
- atf_test_case sep
- sep_body() {
- atf_check -o "inline:1-2-3\n" ../cmd/seq -s - 3
- }
- atf_test_case term
- term_body() {
- atf_check -o "inline:1-2-3:" ../cmd/seq -s - -t: 3
- }
- atf_test_case noarg
- noarg_body() {
- atf_check -s exit:1 -e 'inline:usage: seq [-w] [-s separator] [first [step]] last\n' ../cmd/seq
- }
- atf_test_case badflag
- badflag_body() {
- atf_check -s exit:1 -e 'inline:usage: seq [-w] [-s separator] [first [step]] last\n' ../cmd/seq -f
- }
- atf_test_case limits
- limits_body() {
- atf_check ../cmd/seq 9223372036854775806 9223372036854775807
- atf_check -s exit:1 ../cmd/seq 9223372036854775806 9223372036854775808
- atf_check ../cmd/seq -- -9223372036854775807 -9223372036854775808
- atf_check -s exit:1 ../cmd/seq -- -9223372036854775807 -9223372036854775809
- }
- atf_test_case initial_d
- initial_d_body() {
- atf_check -e "inline:seq: Warning: Pass -- if the first non-option argument starts with a dash(-)\n" -o "inline:-3\n-2\n-1\n0\n" ../cmd/seq -3 0
- }
- atf_test_case width
- width_body() {
- atf_check -o "inline:-1\n04\n09\n14\n" ../cmd/seq -w -- -1 5 15
- atf_check -o "inline:-3\n-2\n-1\n00\n" ../cmd/seq -w -- -3 1 0
- atf_check -o "inline:-10\n-11\n-12\n-13\n-14\n-15\n" ../cmd/seq -w -- -10 1 -15
- }
- atf_init_test_cases() {
- cd "$(atf_get_srcdir)" || exit 1
- atf_add_test_case one
- atf_add_test_case two
- atf_add_test_case three
- atf_add_test_case sep
- atf_add_test_case term
- atf_add_test_case noarg
- atf_add_test_case badflag
- #atf_add_test_case limits
- atf_add_test_case initial_d
- atf_add_test_case width
- }