VirtualBox

source: kBuild/vendor/grep/2.12/gnulib-tests/test-xstrtol.sh

Last change on this file was 2595, checked in by bird, 12 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

  • Property svn:eol-style set to native
File size: 1.7 KB
Line 
1#!/bin/sh
2: ${srcdir=.}
3. "$srcdir/init.sh"; path_prepend_ .
4
5too_big=99999999999999999999999999999999999999999999999999999999999999999999
6result=0
7
8# test xstrtol
9test-xstrtol 1 >> out 2>&1 || result=1
10test-xstrtol -1 >> out 2>&1 || result=1
11test-xstrtol 1k >> out 2>&1 || result=1
12test-xstrtol ${too_big}h >> out 2>&1 && result=1
13test-xstrtol $too_big >> out 2>&1 && result=1
14test-xstrtol x >> out 2>&1 && result=1
15test-xstrtol 9x >> out 2>&1 && result=1
16test-xstrtol 010 >> out 2>&1 || result=1
17# suffix without integer is valid
18test-xstrtol MiB >> out 2>&1 || result=1
19
20# test xstrtoul
21test-xstrtoul 1 >> out 2>&1 || result=1
22test-xstrtoul -1 >> out 2>&1 && result=1
23test-xstrtoul 1k >> out 2>&1 || result=1
24test-xstrtoul ${too_big}h >> out 2>&1 && result=1
25test-xstrtoul $too_big >> out 2>&1 && result=1
26test-xstrtoul x >> out 2>&1 && result=1
27test-xstrtoul 9x >> out 2>&1 && result=1
28test-xstrtoul 010 >> out 2>&1 || result=1
29test-xstrtoul MiB >> out 2>&1 || result=1
30
31# Find out how to remove carriage returns from output. Solaris /usr/ucb/tr
32# does not understand '\r'.
33if echo solaris | tr -d '\r' | grep solais > /dev/null; then
34 cr='\015'
35else
36 cr='\r'
37fi
38
39# normalize output
40LC_ALL=C tr -d "$cr" < out > k
41mv k out
42
43# compare expected output
44cat > expected <<EOF
451->1 ()
46-1->-1 ()
471k->1024 ()
48invalid suffix in X argument '${too_big}h'
49X argument '$too_big' too large
50invalid X argument 'x'
51invalid suffix in X argument '9x'
52010->8 ()
53MiB->1048576 ()
541->1 ()
55invalid X argument '-1'
561k->1024 ()
57invalid suffix in X argument '${too_big}h'
58X argument '$too_big' too large
59invalid X argument 'x'
60invalid suffix in X argument '9x'
61010->8 ()
62MiB->1048576 ()
63EOF
64
65compare expected out || result=1
66
67Exit $result
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette