couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kocol...@apache.org
Subject [2/5] couch-mrview commit: updated refs/heads/master to 19737b7
Date Tue, 30 Jun 2015 15:39:48 GMT
Use the ?assertEquiv macro for better reporting

Also dynamically compute the value for the `total` field to allow us to
add additional test data over time.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/8e8420b8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/8e8420b8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/8e8420b8

Branch: refs/heads/master
Commit: 8e8420b8873b5b79b07a3076923539a8f5532d14
Parents: 1dc8d52
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Mon Jun 29 16:33:53 2015 -0400
Committer: Adam Kocoloski <adam@cloudant.com>
Committed: Mon Jun 29 21:43:48 2015 -0400

----------------------------------------------------------------------
 test/couch_mrview_collation_tests.erl | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/8e8420b8/test/couch_mrview_collation_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_mrview_collation_tests.erl b/test/couch_mrview_collation_tests.erl
index ccfe5ea..df06ad6 100644
--- a/test/couch_mrview_collation_tests.erl
+++ b/test/couch_mrview_collation_tests.erl
@@ -87,17 +87,13 @@ collation_test_() ->
 
 should_collate_fwd(Db) ->
     {ok, Results} = run_query(Db, []),
-    Expect = [{meta, [{total, 26}, {offset, 0}]}] ++ rows(),
-    %% cannot use _assertEqual since mrview converts
-    %% value 3.0 to 3 making assertion fail
-    ?_assert(Expect == Results).
+    Expect = [{meta, [{total, length(?VALUES)}, {offset, 0}]}] ++ rows(),
+    ?_assertEquiv(Expect, Results).
 
 should_collate_rev(Db) ->
     {ok, Results} = run_query(Db, [{direction, rev}]),
-    Expect = [{meta, [{total, 26}, {offset, 0}]}] ++ lists:reverse(rows()),
-    %% cannot use _assertEqual since mrview converts
-    %% value 3.0 to 3 making assertion fail
-    ?_assert(Expect == Results).
+    Expect = [{meta, [{total, length(?VALUES)}, {offset, 0}]}] ++ lists:reverse(rows()),
+    ?_assertEquiv(Expect, Results).
 
 should_collate_range(Db) ->
     ?_assertNot(
@@ -106,7 +102,7 @@ should_collate_range(Db) ->
                 {ok, Results} = run_query(Db, [{start_key, V}, {end_key, V}]),
                 Id = list_to_binary(integer_to_list(Count)),
                 Expect = [
-                    {meta, [{total, 26}, {offset, Count}]},
+                    {meta, [{total, length(?VALUES)}, {offset, Count}]},
                     {row, [{id, Id}, {key, V}, {value, 0}]}
                 ],
                 case Results == Expect of


Mime
View raw message