213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
|
Test_Render (Test, "(width)", 8, "8");
Test_Render (Test, "(max-width)", 9, "9");
Test_Render (Test, "(min-width)", 10, "10");
exception
when Error : others => Test.Report_Exception (Error);
end Parse_Errors;
procedure Static_Hash_Map (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
begin
if not Natools.Static_Maps.S_Expressions.Templates.Integers.T then
Test.Fail;
end if;
exception
when Error : others => Test.Report_Exception (Error);
end Static_Hash_Map;
end Natools.S_Expressions.Templates.Tests.Integers;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
Test_Render (Test, "(width)", 8, "8");
Test_Render (Test, "(max-width)", 9, "9");
Test_Render (Test, "(min-width)", 10, "10");
exception
when Error : others => Test.Report_Exception (Error);
end Parse_Errors;
procedure Prefix_And_Suffix (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
Ordinal : constant String
:= "(suffix 1:? (th (0 31)) (st 1 21 31) (nd 2 22) (rd 3 23) (0: 0))";
begin
declare
Format : Templates.Integers.Format;
begin
Format.Set_Prefix ((0, 9), To_Atom ("a"));
Format.Set_Prefix ((-99, -10), To_Atom ("b"));
Format.Set_Prefix ((50, 99), To_Atom ("c"));
Format.Set_Prefix (0, To_Atom ("d"));
Format.Set_Prefix (-10, To_Atom ("e"));
Format.Set_Prefix (5, To_Atom ("f"));
Format.Set_Prefix ((7, 52), To_Atom ("g"));
Format.Set_Prefix ((-52, -49), To_Atom ("h"));
Format.Set_Prefix ((-100, -90), To_Atom ("i"));
Format.Remove_Prefix (8);
Test_Render (Test, Format, "", -196, "-196");
Test_Render (Test, Format, "", -101, "-101");
Test_Render (Test, Format, "", -100, "i-100");
Test_Render (Test, Format, "", -90, "i-90");
Test_Render (Test, Format, "", -89, "b-89");
Test_Render (Test, Format, "", -53, "b-53");
Test_Render (Test, Format, "", -52, "h-52");
Test_Render (Test, Format, "", -49, "h-49");
Test_Render (Test, Format, "", -48, "b-48");
Test_Render (Test, Format, "", -11, "b-11");
Test_Render (Test, Format, "", -10, "e-10");
Test_Render (Test, Format, "", -9, "-9");
Test_Render (Test, Format, "", -1, "-1");
Test_Render (Test, Format, "", 0, "d0");
Test_Render (Test, Format, "", 1, "a1");
Test_Render (Test, Format, "", 4, "a4");
Test_Render (Test, Format, "", 5, "f5");
Test_Render (Test, Format, "", 6, "a6");
Test_Render (Test, Format, "", 7, "g7");
Test_Render (Test, Format, "", 8, "8");
Test_Render (Test, Format, "", 9, "g9");
Test_Render (Test, Format, "", 52, "g52");
Test_Render (Test, Format, "", 53, "c53");
Test_Render (Test, Format, "", 99, "c99");
Test_Render (Test, Format, "", 100, "100");
Test_Render (Test, Format, "", 192, "192");
end;
declare
Format : Templates.Integers.Format;
begin
Format.Set_Suffix ((0, 10), To_Atom ("th"));
Format.Set_Suffix (1, To_Atom ("st"));
Format.Remove_Suffix (0);
Test_Render (Test, Format, "", -1, "-1");
Test_Render (Test, Format, "", 0, "0");
Test_Render (Test, Format, "", 1, "1st");
Test_Render (Test, Format, "", 4, "4th");
Test_Render (Test, Format, "", 10, "10th");
end;
Test_Render (Test, Ordinal, -1, "-1?");
Test_Render (Test, Ordinal, 0, "0");
Test_Render (Test, Ordinal, 1, "1st");
Test_Render (Test, Ordinal, 2, "2nd");
Test_Render (Test, Ordinal, 3, "3rd");
Test_Render (Test, Ordinal, 4, "4th");
Test_Render (Test, "(prefix (a) (b invalid (9 5)))", 0, "0");
Test_Render (Test, "(prefix (c (invalid 5) (-1 invalid)))", 0, "0");
Test_Render (Test, "(prefix (d ((invalid) 5) (-1)) ())", 0, "0");
exception
when Error : others => Test.Report_Exception (Error);
end Prefix_And_Suffix;
procedure Static_Hash_Map (Report : in out NT.Reporter'Class) is
Test : NT.Test := Report.Item ("Parse errors in template");
begin
if not Natools.Static_Maps.S_Expressions.Templates.Integers.T then
Test.Fail;
end if;
exception
when Error : others => Test.Report_Exception (Error);
end Static_Hash_Map;
end Natools.S_Expressions.Templates.Tests.Integers;
|