Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | chunked_str0ings-tests: add a few more tests to improve coverage |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
2536bbf6238f5442c7c68dc1fe59cd38 |
| User & Date: | nat 2013-09-29 14:29:41.791 |
Context
|
2013-09-30
| ||
| 18:50 | chunked_str0ings-tests: further improve coverage (900/924 lines) check-in: 4f2d39211e user: nat tags: trunk | |
|
2013-09-29
| ||
| 14:29 | chunked_str0ings-tests: add a few more tests to improve coverage check-in: 2536bbf623 user: nat tags: trunk | |
|
2013-09-28
| ||
| 19:31 | string_slice_tests: full-coverage test suite for string slices check-in: c6d912c37b user: nat tags: trunk | |
Changes
Changes to tests/natools-chunked_strings-tests-coverage.adb.
| ︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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;
begin
NT.Section (Report, "Extra tests for complete coverage");
declare
Name : constant String := "Index_Error raised in Element";
C : Character;
begin
| > > > > > > > > > > > > > > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
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
(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";
C : Character;
begin
|
| ︙ | ︙ | |||
267 268 269 270 271 272 273 274 275 276 277 278 279 |
NT.Info (Report,
"Final interval:" & Natural'Image (First)
& " .." & 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;
Natools.Tests.End_Section (Report);
end Natools.Chunked_Strings.Tests.Coverage;
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 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 |
NT.Info (Report,
"Final interval:" & Natural'Image (First)
& " .." & 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;
|
Changes to tests/natools-chunked_strings-tests-memory.adb.
| ︙ | ︙ | |||
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
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);
Memory_Ref := Allocated_Size (CS);
Free_Extra_Memory (CS);
| > > > > > > > > > > > > > > > > > > > > > > > > | 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
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);
Free_Extra_Memory (CS);
|
| ︙ | ︙ |