Natools

Check-in [8608b41131]
Login
Overview
Comment:tests: add Generic_Check helper procedure
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8608b411316f9a51bf4ffd29a54d0a2fa99a0f4d
User & Date: nat on 2014-08-13 20:27:13
Other Links: manifest | tags
Context
2014-08-14
17:11
cron-tests: use the new Generic_Check tool check-in: 7daa408712 user: nat tags: trunk
2014-08-13
20:27
tests: add Generic_Check helper procedure check-in: 8608b41131 user: nat tags: trunk
2014-08-12
21:06
s_expressions-atom_buffers: make Atom_Buffer type limited, since copying such objects would cause complex and useless consequences check-in: 190e69b741 user: nat tags: trunk
Changes

Modified src/natools-tests.adb from [e65e6f7869] to [9cdb4d9320].

128
129
130
131
132
133
134























135
         while Info_Lists.Has_Element (Cursor) loop
            Object.Report.Info (Info_Lists.Element (Cursor));
            Info_Lists.Next (Cursor);
         end loop;
      end if;
   end Finalize;
























end Natools.Tests;







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

128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
         while Info_Lists.Has_Element (Cursor) loop
            Object.Report.Info (Info_Lists.Element (Cursor));
            Info_Lists.Next (Cursor);
         end loop;
      end if;
   end Finalize;


   procedure Generic_Check
     (Object : in out Test;
      Expected : in Result;
      Found : in Result;
      Label : in String := "") is
   begin
      if Expected /= Found then
         if Multiline then
            Fail (Object, Label);
            Info (Object, "Expected: " & Image (Expected));
            Info (Object, "Found:    " & Image (Found));
         elsif Label /= "" then
            Fail (Object, Label
              & ": expected " & Image (Expected)
              & ", found " & Image (Found));
         else
            Fail (Object, "Expected " & Image (Expected)
              & ", found " & Image (Found));
         end if;
      end if;
   end Generic_Check;

end Natools.Tests;

Modified src/natools-tests.ads from [052149f59b] to [d1825e10b9].

116
117
118
119
120
121
122











123
124
125
126
127
128
129
      --  Append information about Ex to the test and set its result state

   procedure Fail (Object : in out Test; Text : in String := "");
   procedure Error (Object : in out Test; Text : in String := "");
   procedure Skip (Object : in out Test; Text : in String := "");
      --  Set the result state and append Text info in a single call












private

   package Info_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists
     (String);

   type Test (Report : access Reporter'Class) is
     new Ada.Finalization.Limited_Controlled with record







>
>
>
>
>
>
>
>
>
>
>







116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
      --  Append information about Ex to the test and set its result state

   procedure Fail (Object : in out Test; Text : in String := "");
   procedure Error (Object : in out Test; Text : in String := "");
   procedure Skip (Object : in out Test; Text : in String := "");
      --  Set the result state and append Text info in a single call

   generic
      type Result (<>) is limited private;
      with function "=" (Left, Right : Result) return Boolean is <>;
      with function Image (Object : Result) return String is <>;
      Multiline : Boolean := True;
   procedure Generic_Check
     (Object : in out Test;
      Expected : in Result;
      Found : in Result;
      Label : in String := "");

private

   package Info_Lists is new Ada.Containers.Indefinite_Doubly_Linked_Lists
     (String);

   type Test (Report : access Reporter'Class) is
     new Ada.Finalization.Limited_Controlled with record