Natools

Check-in [7d6b6a6e6e]
Login
Overview
Comment:s_expressions-cache_tests: add checks using empty reference and cursor
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7d6b6a6e6e4e45da9b0cf6dd4c6c7554d642311a
User & Date: nat on 2014-02-24 19:31:04
Other Links: manifest | tags
Context
2014-02-25
19:45
s_expressions-generic_caches: fix exception in empty Cursor assignment (though I don't understand what was wrong) check-in: eade42f305 user: nat tags: trunk
2014-02-24
19:31
s_expressions-cache_tests: add checks using empty reference and cursor check-in: 7d6b6a6e6e user: nat tags: trunk
2014-02-23
17:55
s_expressions-generic_caches: turn a useless check into a precondition check-in: f06c3f6401 user: nat tags: trunk
Changes

Modified tests/natools-s_expressions-cache_tests.adb from [0c1398f6a4] to [ff4dd3eb96].

116
117
118
119
120
121
122















123
124
125
126
127
128
129
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
141
142
143
144







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







         Print_Info (Pool);
         Flush;
      end Info_Pool;
   begin
      declare
         Cache, Deep, Shallow : Debug_Caches.Reference;
      begin
         declare
            Empty_Cursor : Debug_Caches.Cursor := Deep.First;
            Event : Events.Event;
         begin
            Event := Empty_Cursor.Current_Event;
            if Event /= Events.End_Of_Input then
               Test.Fail ("Unexpected Empty_Cursor.Current_Event "
                 & Events.Event'Image (Event)
                 & " (expected End_Of_Input)");
            end if;

            Test_Tools.Next_And_Check
              (Test, Empty_Cursor, Events.End_Of_Input, 0);
         end;

         Inject_Test (Cache);

         declare
            First : Debug_Caches.Cursor := Cache.First;
            Output : aliased Test_Tools.Memory_Stream;
            Pr : Printers.Canonical (Output'Access);
         begin
175
176
177
178
179
180
181














182
183
184
185
186
187
188
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217







+
+
+
+
+
+
+
+
+
+
+
+
+
+








   procedure Default_Instantiation (Report : in out NT.Reporter'Class) is
      Test : NT.Test := Report.Item ("Default instantiation");
   begin
      declare
         Cache, Deep, Shallow : Caches.Reference;
      begin
         declare
            Empty_Cursor : Caches.Cursor := Deep.First;
            Event : Events.Event;
         begin
            Event := Empty_Cursor.Current_Event;
            if Event /= Events.End_Of_Input then
               Test.Fail ("Unexpected Empty_Cursor.Current_Event "
                 & Events.Event'Image (Event)
                 & " (expected End_Of_Input)");
            end if;

            Test_Tools.Next_And_Check
              (Test, Empty_Cursor, Events.End_Of_Input, 0);
         end;
         Inject_Test (Cache);

         declare
            First : Caches.Cursor := Cache.First;
            Output : aliased Test_Tools.Memory_Stream;
            Pr : Printers.Canonical (Output'Access);
         begin