couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject svn commit: r780350 - in /couchdb/trunk/test/etap: 010-file-basics.t 011-file-headers.t 020-btree-basics.t 021-btree-reductions.t 031-doc-to-json.t
Date Sun, 31 May 2009 00:22:25 GMT
Author: davisp
Date: Sun May 31 00:22:25 2009
New Revision: 780350

URL: http://svn.apache.org/viewvc?rev=780350&view=rev
Log:
Had to swap macro definitions to support R12B.


Modified:
    couchdb/trunk/test/etap/010-file-basics.t
    couchdb/trunk/test/etap/011-file-headers.t
    couchdb/trunk/test/etap/020-btree-basics.t
    couchdb/trunk/test/etap/021-btree-reductions.t
    couchdb/trunk/test/etap/031-doc-to-json.t

Modified: couchdb/trunk/test/etap/010-file-basics.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/010-file-basics.t?rev=780350&r1=780349&r2=780350&view=diff
==============================================================================
--- couchdb/trunk/test/etap/010-file-basics.t (original)
+++ couchdb/trunk/test/etap/010-file-basics.t Sun May 31 00:22:25 2009
@@ -2,7 +2,7 @@
 %% -*- erlang -*-
 %%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
 
--define(FILE_NAME, "./test/etap/temp.010").
+filename() -> "./test/etap/temp.010".
 
 main(_) ->
     code:add_pathz("src/couchdb"),
@@ -22,11 +22,11 @@
 
     etap:fun_is(
         fun({ok, _}) -> true; (_) -> false end,
-        couch_file:open(?FILE_NAME ++ ".1", [create, invalid_option]),
+        couch_file:open(filename() ++ ".1", [create, invalid_option]),
         "Invalid flags to open are ignored."
     ),
 
-    {ok, Fd} = couch_file:open(?FILE_NAME ++ ".0", [create, overwrite]),
+    {ok, Fd} = couch_file:open(filename() ++ ".0", [create, overwrite]),
     etap:ok(is_pid(Fd),
         "Returned file descriptor is a Pid"),
     

Modified: couchdb/trunk/test/etap/011-file-headers.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/011-file-headers.t?rev=780350&r1=780349&r2=780350&view=diff
==============================================================================
--- couchdb/trunk/test/etap/011-file-headers.t (original)
+++ couchdb/trunk/test/etap/011-file-headers.t Sun May 31 00:22:25 2009
@@ -2,8 +2,8 @@
 %% -*- erlang -*-
 %%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
 
--define(FILE_NAME, "./test/etap/temp.011").
--define(SIZE_BLOCK, 4096). % Need to keep this in sync with couch_file.erl
+filename() -> "./test/etap/temp.011".
+sizeblock() -> 4096. % Need to keep this in sync with couch_file.erl
 
 main(_) ->
     code:add_pathz("src/couchdb"),
@@ -21,7 +21,7 @@
     ok.
     
 test() ->
-    {ok, Fd} = couch_file:open(?FILE_NAME, [create,overwrite]),
+    {ok, Fd} = couch_file:open(filename(), [create,overwrite]),
     
     etap:is({ok, 0}, couch_file:bytes(Fd),
         "File should be initialized to contain zero bytes."),
@@ -103,8 +103,8 @@
     ok.
 
 check_header_recovery(CheckFun) ->
-    {ok, Fd} = couch_file:open(?FILE_NAME, [create,overwrite]),
-    {ok, RawFd} = file:open(?FILE_NAME, [read, write, raw, binary]),
+    {ok, Fd} = couch_file:open(filename(), [create,overwrite]),
+    {ok, RawFd} = file:open(filename(), [read, write, raw, binary]),
 
     {ok, _} = write_random_data(Fd),
     ExpectHeader = {some_atom, <<"a binary">>, 756},
@@ -124,7 +124,7 @@
 
 write_random_data(Fd, 0) ->
     {ok, Bytes} = couch_file:bytes(Fd),
-    {ok, (1 + Bytes div ?SIZE_BLOCK) * ?SIZE_BLOCK};
+    {ok, (1 + Bytes div sizeblock()) * sizeblock()};
 write_random_data(Fd, N) ->
     Choices = [foo, bar, <<"bizzingle">>, "bank", ["rough", stuff]],
     Term = lists:nth(random:uniform(4) + 1, Choices),

Modified: couchdb/trunk/test/etap/020-btree-basics.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/020-btree-basics.t?rev=780350&r1=780349&r2=780350&view=diff
==============================================================================
--- couchdb/trunk/test/etap/020-btree-basics.t (original)
+++ couchdb/trunk/test/etap/020-btree-basics.t Sun May 31 00:22:25 2009
@@ -2,8 +2,8 @@
 %% -*- erlang -*-
 %%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
 
--define(FILE_NAME, "./test/etap/temp.020").
--define(ROWS, 250).
+filename() -> "./test/etap/temp.020".
+rows() -> 250.
 
 -record(btree, {fd, root, extract_kv, assemble_kv, less, reduce}).
 
@@ -23,7 +23,7 @@
 %% broken into multiple nodes. AKA "How do we appropiately detect if multiple
 %% nodes were created."
 test()->
-    Sorted = [{Seq, random:uniform()} || Seq <- lists:seq(1, ?ROWS)],
+    Sorted = [{Seq, random:uniform()} || Seq <- lists:seq(1, rows())],
     etap:ok(test_kvs(Sorted), "Testing sorted keys"),
     etap:ok(test_kvs(lists:reverse(Sorted)), "Testing reversed sorted keys"),
     etap:ok(test_kvs(shuffle(Sorted)), "Testing shuffled keys."),
@@ -39,7 +39,7 @@
 
     Keys = [K || {K, _} <- KeyValues],
 
-    {ok, Fd} = couch_file:open(?FILE_NAME, [create,overwrite]),
+    {ok, Fd} = couch_file:open(filename(), [create,overwrite]),
     {ok, Btree} = couch_btree:open(nil, Fd),
     etap:ok(is_record(Btree, btree), "Created btree is really a btree record"),
     etap:is(Btree#btree.fd, Fd, "Btree#btree.fd is set correctly."),

Modified: couchdb/trunk/test/etap/021-btree-reductions.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/021-btree-reductions.t?rev=780350&r1=780349&r2=780350&view=diff
==============================================================================
--- couchdb/trunk/test/etap/021-btree-reductions.t (original)
+++ couchdb/trunk/test/etap/021-btree-reductions.t Sun May 31 00:22:25 2009
@@ -2,8 +2,8 @@
 %% -*- erlang -*-
 %%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
 
--define(FILE_NAME, "./test/etap/temp.021").
--define(ROWS, 1000).
+filename() -> "./test/etap/temp.021".
+rows() -> 1000.
 
 main(_) ->
     code:add_pathz("src/couchdb"),
@@ -23,7 +23,7 @@
         (rereduce, Reds) -> lists:sum(Reds)
     end,
     
-    {ok, Fd} = couch_file:open(?FILE_NAME, [create,overwrite]),
+    {ok, Fd} = couch_file:open(filename(), [create,overwrite]),
     {ok, Btree} = couch_btree:open(nil, Fd, [{reduce, ReduceFun}]),
     
     % Create a list, of {"even", Value} or {"odd", Value} pairs.
@@ -32,7 +32,7 @@
             "even" -> {"odd", [{{Key, Idx}, 1} | Acc]};
             _ -> {"even", [{{Key, Idx}, 1} | Acc]}
         end
-    end, {"odd", []}, lists:seq(1, ?ROWS)),
+    end, {"odd", []}, lists:seq(1, rows())),
 
     {ok, Btree2} = couch_btree:add_remove(Btree, EvenOddKVs, []),
 
@@ -46,7 +46,7 @@
 
     etap:fun_is(
         fun
-            ({ok, [{{"odd", _}, ?ROWS div 2}, {{"even", _}, ?ROWS div 2}]}) ->
+            ({ok, [{{"odd", _}, 500}, {{"even", _}, 500}]}) ->
                 true;
             (_) ->
                 false
@@ -57,7 +57,7 @@
 
     etap:fun_is(
         fun
-            ({ok, [{{"odd", _}, ?ROWS div 2}, {{"even", _}, ?ROWS div 2}]}) ->
+            ({ok, [{{"odd", _}, 500}, {{"even", _}, 500}]}) ->
                 true;
             (_) ->
                 false
@@ -68,7 +68,7 @@
 
     etap:fun_is(
         fun
-            ({ok, [{{"even", _}, ?ROWS div 2}, {{"odd", _}, ?ROWS div 2}]}) ->
+            ({ok, [{{"even", _}, 500}, {{"odd", _}, 500}]}) ->
                 true;
             (_) ->
                 false
@@ -79,7 +79,7 @@
     
     etap:fun_is(
         fun
-            ({ok, [{{"odd", _}, ?ROWS div 2}, {{"even", _}, ?ROWS div 2}]}) ->
+            ({ok, [{{"odd", _}, 500}, {{"even", _}, 500}]}) ->
                 true;
             (_) ->
                 false
@@ -90,7 +90,7 @@
     
     etap:fun_is(
         fun
-            ({ok, [{{"even", _}, ?ROWS div 2}]}) -> true;
+            ({ok, [{{"even", _}, 500}]}) -> true;
             (_) -> false
         end,
         couch_btree:fold_reduce(Btree2, fwd, SK1, EK1, GroupFun, FoldFun, []),
@@ -99,7 +99,7 @@
 
     etap:fun_is(
         fun
-            ({ok, [{{"odd", _}, ?ROWS div 2}]}) -> true;
+            ({ok, [{{"odd", _}, 500}]}) -> true;
             (_) -> false
         end,
         couch_btree:fold_reduce(Btree2, fwd, SK2, EK2, GroupFun, FoldFun, []),
@@ -108,7 +108,7 @@
 
     etap:fun_is(
         fun
-            ({ok, [{{"odd", _}, ?ROWS div 2}]}) -> true;
+            ({ok, [{{"odd", _}, 500}]}) -> true;
             (_) -> false
         end,
         couch_btree:fold_reduce(Btree2, rev, EK2, SK2, GroupFun, FoldFun, []),
@@ -117,7 +117,7 @@
     
     etap:fun_is(
         fun
-            ({ok, [{{"even", _}, ?ROWS div 2}, {{"odd", _}, ?ROWS div 2}]}) ->
+            ({ok, [{{"even", _}, 500}, {{"odd", _}, 500}]}) ->
                 true;
             (_) ->
                 false

Modified: couchdb/trunk/test/etap/031-doc-to-json.t
URL: http://svn.apache.org/viewvc/couchdb/trunk/test/etap/031-doc-to-json.t?rev=780350&r1=780349&r2=780350&view=diff
==============================================================================
--- couchdb/trunk/test/etap/031-doc-to-json.t (original)
+++ couchdb/trunk/test/etap/031-doc-to-json.t Sun May 31 00:22:25 2009
@@ -150,3 +150,4 @@
             etap:is(couch_doc:to_json_obj(Doc, Options), EJson, Mesg)
     end, Cases),
     ok.
+



Mime
View raw message