Index: tests/natools-chunked_strings-tests-coverage.adb ================================================================== --- tests/natools-chunked_strings-tests-coverage.adb +++ tests/natools-chunked_strings-tests-coverage.adb @@ -19,10 +19,27 @@ procedure Natools.Chunked_Strings.Tests.Coverage (Report : in out Natools.Tests.Reporter'Class) is package NT renames Natools.Tests; + + procedure Report_Result + (Name : in String; + Reported : in out Boolean; + Result : in NT.Result := NT.Fail); + -- Report Result unless already reported + + procedure Report_Result + (Name : in String; + Reported : in out Boolean; + Result : in NT.Result := NT.Fail) is + begin + if not Reported then + NT.Item (Report, Name, Result); + Reported := True; + end if; + end Report_Result; begin NT.Section (Report, "Extra tests for complete coverage"); declare Name : constant String := "Index_Error raised in Element"; @@ -269,11 +286,53 @@ & " .." & Natural'Image (Last)); NT.Info (Report, "Expected: 3 .. 5"); else NT.Item (Report, Name, NT.Success); end if; + exception + when Error : others => NT.Report_Exception (Report, Name, Error); + end; + + declare + Name : constant String := "Comparisons of Chunked_Strings"; + CS_Name : constant Chunked_String := To_Chunked_String (Name); + Prefix : constant Chunked_String := To_Chunked_String ("Comparisons"); + Smaller : constant Chunked_String := To_Chunked_String ("Ca"); + Reported : Boolean := False; + begin + if CS_Name <= Null_Chunked_String then + Report_Result (Name, Reported); + NT.Info (Report, "CS_Name <= Null_Chunked_String"); + end if; + + if Null_Chunked_String >= CS_Name then + Report_Result (Name, Reported); + NT.Info (Report, "Null_Chunked_String >= CS_Name"); + end if; + + if Prefix >= CS_Name then + Report_Result (Name, Reported); + NT.Info (Report, "Prefix >= CS_Name"); + end if; + + if CS_Name <= Prefix then + Report_Result (Name, Reported); + NT.Info (Report, "CS_Name <= Prefix"); + end if; + + if Smaller >= CS_Name then + Report_Result (Name, Reported); + 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; Index: tests/natools-chunked_strings-tests-memory.adb ================================================================== --- tests/natools-chunked_strings-tests-memory.adb +++ tests/natools-chunked_strings-tests-memory.adb @@ -62,10 +62,34 @@ end; declare Name : constant String := "Procedure Free_Extra_Memory"; CS : Chunked_String; + Memory_Ref : Natural; + Repeats : constant Positive := 50; + begin + Preallocate (CS, Repeats * Name'Length); + Append (CS, Name); + Memory_Ref := Allocated_Size (CS); + Free_Extra_Memory (CS); + + if Memory_Ref <= Allocated_Size (CS) then + NT.Item (Report, Name, NT.Fail); + NT.Info (Report, "Memory before:" + & Natural'Image (Memory_Ref)); + NT.Info (Report, "Memory after:" + & Natural'Image (Allocated_Size (CS))); + else + NT.Item (Report, Name, NT.Success); + end if; + exception + when Error : others => NT.Report_Exception (Report, Name, Error); + end; + + declare + Name : constant String := "Procedure Free_Extra_Memory (empty)"; + CS : Chunked_String; Memory_Ref : Natural; Repeats : constant Positive := 50; begin Preallocate (CS, Repeats * Name'Length); Memory_Ref := Allocated_Size (CS);