Natools

Diff
Login

Differences From Artifact [e9a5d7e043]:

To Artifact [364a803ccf]:


12
13
14
15
16
17
18

19
20
21
22
23
24
25
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

with Ada.Exceptions;
with Ada.Strings.Fixed;


procedure Natools.Chunked_Strings.Tests.Coverage
  (Report : in out Natools.Tests.Reporter'Class)
is
   package NT renames Natools.Tests;

   procedure Report_Result







>







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN    --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF  --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.           --
------------------------------------------------------------------------------

with Ada.Exceptions;
with Ada.Strings.Fixed;
with Ada.Strings.Maps;

procedure Natools.Chunked_Strings.Tests.Coverage
  (Report : in out Natools.Tests.Reporter'Class)
is
   package NT renames Natools.Tests;

   procedure Report_Result
324
325
326
327
328
329
330





















































331
332
333
334
335
336
337
338
         NT.Info (Report, "Smaller >= CS_Name");
      end if;

      if CS_Name <= Smaller then
         Report_Result (Name, Reported);
         NT.Info (Report, "CS_Name <= Smaller");
      end if;






















































      Report_Result (Name, Reported, NT.Success);
   exception
      when Error : others => NT.Report_Exception (Report, Name, Error);
   end;

   Natools.Tests.End_Section (Report);
end Natools.Chunked_Strings.Tests.Coverage;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








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
387
388
389
390
391
392
         NT.Info (Report, "Smaller >= CS_Name");
      end if;

      if CS_Name <= Smaller then
         Report_Result (Name, Reported);
         NT.Info (Report, "CS_Name <= Smaller");
      end if;

      Report_Result (Name, Reported, NT.Success);
   exception
      when Error : others => NT.Report_Exception (Report, Name, Error);
   end;

   declare
      Name : constant String := "Procedure Index, backwards without match";
      CS : constant Chunked_String := To_Chunked_String (Name);
      N : Natural;
   begin
      N := Index
        (Source => CS,
         Set => Ada.Strings.Maps.To_Set ("."),
         Test => Ada.Strings.Inside,
         Going => Ada.Strings.Backward);

      if N /= 0 then
         NT.Item (Report, Name, NT.Fail);
         NT.Info (Report, "Unexpected match at" & Natural'Image (N));
      else
         NT.Item (Report, Name, NT.Success);
      end if;
   exception
      when Error : others => NT.Report_Exception (Report, Name, Error);
   end;

   declare
      Name : constant String := "Function Trim, one-sided";
      Str : constant String := "   word  ";
      Reported : Boolean := False;
   begin
      declare
         CS : constant Chunked_String := To_Chunked_String (Str);
         Left : constant String
           := Ada.Strings.Fixed.Trim (Str, Ada.Strings.Left);
         Right : constant String
           := Ada.Strings.Fixed.Trim (Str, Ada.Strings.Right);
         CS_Left : constant Chunked_String := Trim (CS, Ada.Strings.Left);
         CS_Right : constant Chunked_String := Trim (CS, Ada.Strings.Right);
      begin
         if To_String (CS_Left) /= Left then
            Report_Result (Name, Reported);
            NT.Info (Report, "Found """ & To_String (CS_Left) & '"');
            NT.Info (Report, "Expected """ & Left & '"');
         end if;

         if To_String (CS_Right) /= Right then
            Report_Result (Name, Reported);
            NT.Info (Report, "Found """ & To_String (CS_Right) & '"');
            NT.Info (Report, "Expected """ & Right & '"');
         end if;
      end;

      Report_Result (Name, Reported, NT.Success);
   exception
      when Error : others => NT.Report_Exception (Report, Name, Error);
   end;

   Natools.Tests.End_Section (Report);
end Natools.Chunked_Strings.Tests.Coverage;