comparison tests/printf.test @ 1485:8700cbe1cb29 draft

Move testsuite out of scripts/test into its own top level tests directory, and make ctrl-c kill "make test" more reliably.
author Rob Landley <rob@landley.net>
date Sat, 20 Sep 2014 13:09:14 -0500
parents scripts/test/printf.test@94677e7b6d97
children 35c035b7e3e0
comparison
equal deleted inserted replaced
1484:19435f12ec63 1485:8700cbe1cb29
1 #!/bin/bash
2
3 # Copyright 2013 Robin Mittal <robinmittal.it@gmail.com>
4 # Copyright 2013 Divya Kothari <divya.s.kothari@gmail.com>
5
6 [ -f testing.sh ] && . testing.sh
7
8 #testing "name" "command" "result" "infile" "stdin"
9 #set -x
10
11 testing "printf TEXT" "printf toyTestText" "toyTestText" "" ""
12 testing "printf MULTILINE_TEXT" \
13 "printf 'Testing\nmultiline\ntext\nfrom\ntoybox\tcommand.\b'" \
14 "Testing\nmultiline\ntext\nfrom\ntoybox\tcommand.\b" "" ""
15 testing "printf '%5d%4d' 1 21 321 4321 54321" \
16 "printf '%5d%4d' 1 21 321 4321 54321" " 1 21 321432154321 0" "" ""
17 testing "printf '%c %c' 78 79" "printf '%c %c' 78 79" "7 7" "" ""
18 testing "printf '%d %d' 78 79" "printf '%d %d' 78 79" "78 79" "" ""
19 testing "printf '%f %f' 78 79" "printf '%f %f' 78 79" \
20 "78.000000 79.000000" "" ""
21 testing "printf 'f f' 78 79" "printf 'f f' 78 79" "f f" "" ""
22 testing "printf '%i %i' 78 79" "printf '%i %i' 78 79" "78 79" "" ""
23 testing "printf '%o %o' 78 79" "printf '%o %o' 78 79" "116 117" "" ""
24 testing "printf '%u %u' 78 79" "printf '%u %u' 78 79" "78 79" "" ""
25 testing "printf '%u %u' -1 -2" "printf '%u %u' -1 -2" \
26 "18446744073709551615 18446744073709551614" "" ""
27 testing "printf '%x %X' 78 79" "printf '%x %X' 78 79" "4e 4F" "" ""
28 testing "printf '%g %G' 78 79" "printf '%g %G' 78 79" "78 79" "" ""
29 testing "printf '%s %s' 78 79" "printf '%s %s' 78 79" "78 79" "" ""