seq (2436B)
- #!/usr/bin/env atf-sh
- # SPDX-FileCopyrightText: 2017-2022 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 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_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 noarg
- atf_add_test_case badflag
- #atf_add_test_case limits
- }