Lines Matching refs:tests

45 typeset -A tests=()
48 typeset -A tests[01]=()
49 tests[01][desc]="hexadecimal lowercase"
50 tests[01][format]='%04x'
51 tests[01][args]="255"
52 tests[01][result]="00ff"
54 typeset -A tests[02]=()
55 tests[02][desc]="hexadecimal 32-bit"
56 tests[02][format]='%08x'
57 tests[02][args]='65537'
58 tests[02][result]=00010001
60 typeset -A tests[03]=()
61 tests[03][desc]="multiple arguments"
62 tests[03][format]='%d %s '
63 tests[03][args]="1 one 2 two 3 three"
64 tests[03][result]='1 one 2 two 3 three '
66 typeset -A tests[04]=()
67 tests[04][desc]="variable position parameters"
68 tests[04][format]='%2$s %1$d '
69 tests[04][args]="1 one 2 two 3 three"
70 tests[04][result]='one 1 two 2 three 3 '
72 typeset -A tests[05]=()
73 tests[05][desc]="width"
74 tests[05][format]='%10s'
75 tests[05][args]="abcdef"
76 tests[05][result]=' abcdef'
78 typeset -A tests[06]=()
79 tests[06][desc]="width and precision"
80 tests[06][format]='%10.3s'
81 tests[06][args]="abcdef"
82 tests[06][result]=' abc'
84 typeset -A tests[07]=()
85 tests[07][desc]="variable width and precision"
86 tests[07][format]='%*.*s'
87 tests[07][args]="10 3 abcdef"
88 tests[07][result]=' abc'
90 typeset -A tests[08]=()
91 tests[08][desc]="variable position width and precision"
92 tests[08][format]='%2$*1$.*3$s'
93 tests[08][args]="10 abcdef 3"
94 tests[08][result]=' abc'
96 typeset -A tests[09]=()
97 tests[09][desc]="multi variable position width and precision"
98 tests[09][format]='%2$*1$.*3$s'
99 tests[09][args]="10 abcdef 3 5 xyz 1"
100 tests[09][result]=' abc x'
102 typeset -A tests[10]=()
103 tests[10][desc]="decimal from hex"
104 tests[10][format]='%d '
105 tests[10][args]="0x1000 0XA"
106 tests[10][result]='4096 10 '
108 typeset -A tests[11]=()
109 tests[11][desc]="negative dec (64-bit)"
110 tests[11][format]='%x'
111 tests[11][args]="-1"
112 tests[11][result]='ffffffffffffffff'
114 typeset -A tests[12]=()
115 tests[12][desc]="float (basic)"
116 tests[12][format]='%f'
117 tests[12][args]="3.14"
118 tests[12][result]='3.140000'
120 typeset -A tests[12]=()
121 tests[12][desc]="float precision"
122 tests[12][format]='%.2f'
123 tests[12][args]="3.14159"
124 tests[12][result]='3.14'
126 typeset -A tests[13]=()
127 tests[13][desc]="left justify"
128 tests[13][format]='%-5d'
129 tests[13][args]="45"
130 tests[13][result]='45 '
132 typeset -A tests[14]=()
133 tests[14][desc]="newlines"
134 tests[14][format]='%s\n%s\n%s'
135 tests[14][args]="one two three"
136 tests[14][result]='one
140 typeset -A tests[15]=()
141 tests[15][desc]="embedded octal escape"
142 tests[15][format]='%s\41%s'
143 tests[15][args]="one two"
144 tests[15][result]='one!two'
146 typeset -A tests[16]=()
147 tests[16][desc]="backslash string (%b)"
148 tests[16][format]='%b'
149 tests[16][args]='\0101\0102\0103'
150 tests[16][result]='ABC'
152 typeset -A tests[17]=()
153 tests[17][desc]="backslash c in %b"
154 tests[17][format]='%b%s'
155 tests[17][args]='\0101\cone two'
156 tests[17][result]='A'
158 typeset -A tests[18]=()
159 tests[18][desc]="backslash octal in format"
160 tests[18][format]='HI\1120K\0112tabbed\11again'
161 tests[18][args]=
162 tests[18][result]='HIJ0K 2tabbed again'
164 typeset -A tests[19]=()
165 tests[19][desc]="backslash octal in %b"
166 tests[19][format]="%b"
167 tests[19][args]='HI\0112K\011tabbed'
168 tests[19][result]='HIJK tabbed'
170 typeset -A tests[20]=()
171 tests[20][desc]="numeric %d and ASCII conversions"
172 tests[20][format]='%d '
173 tests[20][args]="3 +3 -3 \"3 \"+ '-"
174 tests[20][result]='3 3 -3 51 43 45 '
176 typeset -A tests[21]=()
177 tests[21][desc]="verify second arg only"
178 tests[21][format]='%2$s'
179 tests[21][args]='abc xyz'
180 tests[21][result]="xyz"
182 typeset -A tests[22]=()
183 tests[22][desc]="verify missing signed arg"
184 tests[22][format]='%d %d'
185 tests[22][args]='151'
186 tests[22][result]="151 0"
188 typeset -A tests[23]=()
189 tests[23][desc]="verify missing unsigned arg"
190 tests[23][format]='%u %u'
191 tests[23][args]='151'
192 tests[23][result]="151 0"
198 desc=${tests[$i][desc]}
199 format=${tests[$i][format]}
201 result=${tests[$i][result]}