305
306
307
308
309
310
311
312
313
314
315
316
317
318
|
end Short_Read_Atom_Test;
if Print_Expected then
Dump_Atom (Test, Expected, "Expected");
end if;
end Test_Atom_Accessors;
-------------------
-- Memory Stream --
-------------------
overriding procedure Read
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
|
end Short_Read_Atom_Test;
if Print_Expected then
Dump_Atom (Test, Expected, "Expected");
end if;
end Test_Atom_Accessors;
procedure Test_Atom_Accessor_Exceptions
(Test : in out NT.Test;
Tested : in Descriptor'Class) is
begin
if Tested.Current_Event = Events.Add_Atom then
Test.Error ("Test_Atom_Accessor_Exceptions during Events.Add_Atom");
return;
end if;
Current_Atom_Test :
begin
declare
Data : constant Atom := Tested.Current_Atom;
begin
Test.Fail ("No exception raised in Current_Atom");
Dump_Atom (Test, Data, "Returned value");
end;
exception
when Program_Error => null;
when Error : others =>
Test.Fail ("Wrong exception raised in Current_Atom");
Test.Report_Exception (Error, NT.Fail);
end Current_Atom_Test;
Query_Atom_Test :
declare
procedure Process (Data : in Atom);
Calls : Natural := 0;
Buffer : Atom_Buffers.Atom_Buffer;
procedure Process (Data : in Atom) is
begin
Calls := Calls + 1;
Buffer.Append (Data);
end Process;
begin
Tested.Query_Atom (Process'Access);
Test.Fail ("No exception raised in Query_Atom");
Dump_Atom (Test, Buffer.Data,
"Buffer from" & Natural'Image (Calls) & " calls");
exception
when Program_Error => null;
when Error : others =>
Test.Fail ("Wrong exception raised in Query_Atom");
Test.Report_Exception (Error, NT.Fail);
end Query_Atom_Test;
Read_Atom_Test :
declare
Buffer : Atom (0 .. 31) := (others => 46);
Length : Count;
begin
Tested.Read_Atom (Buffer, Length);
Test.Fail ("No exception raised in Read_Atom");
Test.Info ("Returned Length:" & Count'Image (Length));
Dump_Atom (Test, Buffer, "Output Buffer");
exception
when Program_Error => null;
when Error : others =>
Test.Fail ("Wrong exception raised in Read_Atom");
Test.Report_Exception (Error, NT.Fail);
end Read_Atom_Test;
end Test_Atom_Accessor_Exceptions;
-------------------
-- Memory Stream --
-------------------
overriding procedure Read
|