Imported Upstream version 1.4.17
[platform/upstream/m4.git] / checks / 180.format
1 dnl @ ../doc/m4.texi:6075: Origin of test
2 dnl @ expected status: 0
3 dnl @ extra options: 
4 dnl @ Copyright (C) 2006, 2007, 2008, 2009 Free Software
5 dnl @ Foundation, Inc.
6 dnl @ This file is free software; the Free Software Foundation
7 dnl @ gives unlimited permission to copy and/or distribute it
8 dnl @ with or without modifications, as long as this notice
9 dnl @ is preserved.
10 define(`foo', `The brown fox jumped over the lazy dog')
11 dnl @result{}
12 format(`The string "%s" uses %d characters', foo, len(foo))
13 dnl @result{}The string "The brown fox jumped over the lazy dog" uses 38 characters
14 format(`%*.*d', `-1', `-1', `1')
15 dnl @result{}1
16 format(`%.0f', `56789.9876')
17 dnl @result{}56790
18 len(format(`%-*X', `5000', `1'))
19 dnl @result{}5000
20 ifelse(format(`%010F', `infinity'), `       INF', `success',
21        format(`%010F', `infinity'), `  INFINITY', `success',
22        format(`%010F', `infinity'))
23 dnl @result{}success
24 ifelse(format(`%.1A', `1.999'), `0X1.0P+1', `success',
25        format(`%.1A', `1.999'), `0X2.0P+0', `success',
26        format(`%.1A', `1.999'))
27 dnl @result{}success
28 format(`%g', `0xa.P+1')
29 dnl @result{}20