You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2023/04/19 03:51:44 UTC

[couchdb] 04/11: mango: increase coverage of the `choose_best_index/1` test

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 3351a2647775050939947ec758dca7001a440d50
Author: Gabor Pali <ga...@ibm.com>
AuthorDate: Wed Mar 22 20:23:02 2023 +0100

    mango: increase coverage of the `choose_best_index/1` test
---
 src/mango/src/mango_cursor_view.erl | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mango/src/mango_cursor_view.erl b/src/mango/src/mango_cursor_view.erl
index 80b7fe205..9abb5cb66 100644
--- a/src/mango/src/mango_cursor_view.erl
+++ b/src/mango/src/mango_cursor_view.erl
@@ -742,13 +742,20 @@ choose_best_index_with_singleton_test() ->
 
 %% - choose the index with the lowest difference between its prefix and field ranges
 choose_best_index_lowest_difference_test() ->
-    IndexRanges =
+    IndexRanges1 =
         [
             {index1, ranges1, 3},
             {index2, ranges2, 2},
             {index3, ranges3, 1}
         ],
-    ?assertEqual({index3, ranges3}, choose_best_index(IndexRanges)).
+    ?assertEqual({index3, ranges3}, choose_best_index(IndexRanges1)),
+    IndexRanges2 =
+        [
+            {index1, ranges1, 3},
+            {index2, ranges2, 1},
+            {index3, ranges3, 2}
+        ],
+    ?assertEqual({index2, ranges2}, choose_best_index(IndexRanges2)).
 
 %% - if that is equal, choose the index with the least number of fields in the index
 choose_best_index_least_number_of_fields_test() ->