1#!/bin/sh
2# Test the "print_extra_number" logic seq.c:print_numbers()
3
4# Copyright (C) 2019-2023 Free Software Foundation, Inc.
5
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
19. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
20print_ver_ seq
21
22##
23## Test 1: the documented reason for the logic
24##
25cat<<'EOF'>exp1 || framework_failure_
260.000000
270.000001
280.000002
290.000003
30EOF
31
32seq 0 0.000001 0.000003 > out1 || fail=1
33compare exp1 out1 || fail=1
34
35
36##
37## Test 2: before 8.32, this resulted in TWO lines
38## (print_extra_number was erroneously set to true)
39## The '=' is there instead of a space to ease visual inspection.
40cat<<'EOF'>exp2 || framework_failure_
411e+06=
42EOF
43
44seq -f "%g=" 1000000 1000000 > out2 || fail=1
45compare exp2 out2 || fail=1
46
47Exit $fail
48