/[eiffelstudio]/branches/eth/eve/Src/library/abel/apps/test/abel_test/ps_repository_tests.e
ViewVC logotype

Diff of /branches/eth/eve/Src/library/abel/apps/test/abel_test/ps_repository_tests.e

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 88482 by romanschmocker, Thu Mar 29 13:49:26 2012 UTC revision 88483 by romanschmocker, Thu Mar 29 21:30:22 2012 UTC
# Line 187  feature {NONE} -- Test criteria setting Line 187  feature {NONE} -- Test criteria setting
187                  do                  do
188                          test_query_one_result_greater_than                          test_query_one_result_greater_than
189                          test_query_one_result_equals_to                          test_query_one_result_equals_to
190                            test_query_one_result_like_string
191                            test_query_no_result_like_string
192                            test_query_four_results_like_string
193                          test_query_many_results_two_criteria_anded                          test_query_many_results_two_criteria_anded
194                          test_query_many_results_two_criteria_ored                          test_query_many_results_two_criteria_ored
195                  end                  end
# Line 229  feature {NONE} -- Test criteria setting Line 232  feature {NONE} -- Test criteria setting
232                          assert ("The person in result is supposed to own 5 items but owns " + p.items_owned.out + " instead.", p.items_owned = 5)                          assert ("The person in result is supposed to own 5 items but owns " + p.items_owned.out + " instead.", p.items_owned = 5)
233                  end                  end
234    
235            test_query_no_result_like_string
236                            -- Test a query using criterion equals_to. One result expected.
237                    local
238                            query: PS_OBJECT_QUERY [PERSON]
239                            p: PERSON
240                    do
241                            create query.make
242                            query.set_criterion (factory [["first_name", factory.like_string, "*lb*"]] and factory[["last_name", factory.like_string, "it*ssi"]])
243                            person_executor.execute_query (query)
244                            assert ("The result list is not empty, but it should be.", query.result_cursor.after)
245                    end
246    
247            test_query_one_result_like_string
248                            -- Test a query using criterion equals_to. One result expected.
249                    local
250                            query: PS_OBJECT_QUERY [PERSON]
251                            p: PERSON
252                    do
253                            create query.make
254                            query.set_criterion (factory [["first_name", factory.like_string, "*lb*"]] and factory[["last_name", factory.like_string, "*?ssi"]])
255                            person_executor.execute_query (query)
256                            assert ("The result list is empty", not query.result_cursor.after)
257                            p := query.result_cursor.item
258                            query.result_cursor.forth
259                            assert ("The result list has more than one item", query.result_cursor.after)
260    
261                            assert ("The person in result is supposed to own 3 items but owns " + p.items_owned.out + " instead.", p.items_owned = 3)
262                    end
263    
264            test_query_four_results_like_string
265                            -- Test a query using criterion equals_to. One result expected.
266                    local
267                            query: PS_OBJECT_QUERY [PERSON]
268                            p1: PERSON
269                            p2: PERSON
270                            p3: PERSON
271                            p4: PERSON
272                            sum:INTEGER
273                    do
274                            create query.make
275                            query.set_criterion (factory [["last_name", factory.like_string, "*i"]])
276                            person_executor.execute_query (query)
277                            assert ("The result list is empty", not query.result_cursor.after)
278                            p1 := query.result_cursor.item
279                            query.result_cursor.forth
280                            assert ("The result list only has one item, but it should have 4", not query.result_cursor.after)
281                            p2:= query.result_cursor.item
282                            query.result_cursor.forth
283                            assert ("The result list only has two items, but it should have 4", not query.result_cursor.after)
284                            p3:= query.result_cursor.item
285                            query.result_cursor.forth
286                            assert ("The result list only has three items, but it should have 4", not query.result_cursor.after)
287                            p4:= query.result_cursor.item
288                            query.result_cursor.forth
289                            assert ("The result list has more than four items", query.result_cursor.after)
290                            sum:= p1.items_owned + p2.items_owned + p3.items_owned + p4.items_owned
291                            assert ("The person in result is supposed to own 13 items but owns " + sum.out + " instead.", sum = 13)
292                    end
293    
294          test_query_many_results_two_criteria_anded          test_query_many_results_two_criteria_anded
295                          -- Test a query using two criteria anded.                          -- Test a query using two criteria anded.
296                  local                  local

Legend:
Removed from v.88482  
changed lines
  Added in v.88483

  ViewVC Help
Powered by ViewVC 1.1.23