320
321
322
323
324
325
326
327
|
if Stream.Mismatch then
return Stream.Expect_Pointer + 1;
else
return 0;
end if;
end Mismatch_Index;
end Natools.S_Expressions.Test_Tools;
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
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
|
if Stream.Mismatch then
return Stream.Expect_Pointer + 1;
else
return 0;
end if;
end Mismatch_Index;
procedure Check_Stream
(Stream : in Test_Tools.Memory_Stream;
Test : in out NT.Test) is
begin
if Stream.Has_Mismatch or else Stream.Unread_Expected /= Null_Atom then
if Stream.Has_Mismatch then
Test.Fail ("Mismatch at position"
& Count'Image (Stream.Mismatch_Index));
declare
Stream_Data : Atom renames Stream.Get_Data;
begin
Test_Tools.Dump_Atom
(Test,
Stream_Data (Stream_Data'First .. Stream.Mismatch_Index - 1),
"Matching data");
Test_Tools.Dump_Atom
(Test,
Stream_Data (Stream.Mismatch_Index .. Stream_Data'Last),
"Mismatching data");
end;
end if;
if Stream.Unread_Expected /= Null_Atom then
Test.Fail;
Test_Tools.Dump_Atom
(Test,
Stream.Unread_Expected,
"Left to expect");
end if;
end if;
end Check_Stream;
end Natools.S_Expressions.Test_Tools;
|