File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed
cpp/ql/test/library-tests/printf/formatLiteral Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 39
39
| test.c:103:10:103:17 | %%%%%f | 320 |
40
40
| test.c:104:10:104:18 | %4.2f%% | |
41
41
| test.c:105:10:105:17 | %%%f%% | 320 |
42
+ | test.c:112:10:112:13 | %f | 318 |
43
+ | test.c:113:10:113:15 | %.1f | |
44
+ | test.c:114:10:114:14 | %1f | 318 |
45
+ | test.c:115:10:115:16 | %1.1f | |
46
+ | test.c:116:10:116:13 | %e | 15 |
47
+ | test.c:117:10:117:15 | %.2e | |
48
+ | test.c:118:10:118:14 | %3e | 15 |
49
+ | test.c:119:10:119:16 | %3.2e | |
50
+ | test.c:120:10:120:13 | %g | 15 |
51
+ | test.c:121:10:121:15 | %.1g | |
52
+ | test.c:122:10:122:14 | %4g | 15 |
53
+ | test.c:123:10:123:16 | %4.1g | |
Original file line number Diff line number Diff line change 37
37
| test.c:103:10:103:17 | %%%%%f | 0 | | f | | file://:0:0:0:0 | double |
38
38
| test.c:104:10:104:18 | %4.2f%% | 0 | | f | | file://:0:0:0:0 | double |
39
39
| test.c:105:10:105:17 | %%%f%% | 0 | | f | | file://:0:0:0:0 | double |
40
+ | test.c:112:10:112:13 | %f | 0 | | f | | file://:0:0:0:0 | double |
41
+ | test.c:113:10:113:15 | %.1f | 0 | | f | | file://:0:0:0:0 | double |
42
+ | test.c:114:10:114:14 | %1f | 0 | | f | | file://:0:0:0:0 | double |
43
+ | test.c:115:10:115:16 | %1.1f | 0 | | f | | file://:0:0:0:0 | double |
44
+ | test.c:116:10:116:13 | %e | 0 | | e | | file://:0:0:0:0 | double |
45
+ | test.c:117:10:117:15 | %.2e | 0 | | e | | file://:0:0:0:0 | double |
46
+ | test.c:118:10:118:14 | %3e | 0 | | e | | file://:0:0:0:0 | double |
47
+ | test.c:119:10:119:16 | %3.2e | 0 | | e | | file://:0:0:0:0 | double |
48
+ | test.c:120:10:120:13 | %g | 0 | | g | | file://:0:0:0:0 | double |
49
+ | test.c:121:10:121:15 | %.1g | 0 | | g | | file://:0:0:0:0 | double |
50
+ | test.c:122:10:122:14 | %4g | 0 | | g | | file://:0:0:0:0 | double |
51
+ | test.c:123:10:123:16 | %4.1g | 0 | | g | | file://:0:0:0:0 | double |
Original file line number Diff line number Diff line change @@ -104,4 +104,22 @@ void more_cases(int a, int b)
104
104
printf ("%4.2f%%" , num );
105
105
printf ("%%%f%%" , num );
106
106
}
107
+
108
+ // more tests of width and precision
109
+ {
110
+ float num ;
111
+
112
+ printf ("%f" , num );
113
+ printf ("%.1f" , num );
114
+ printf ("%1f" , num );
115
+ printf ("%1.1f" , num );
116
+ printf ("%e" , num );
117
+ printf ("%.2e" , num );
118
+ printf ("%3e" , num );
119
+ printf ("%3.2e" , num );
120
+ printf ("%g" , num );
121
+ printf ("%.1g" , num );
122
+ printf ("%4g" , num );
123
+ printf ("%4.1g" , num );
124
+ }
107
125
}
You can’t perform that action at this time.
0 commit comments