WIP: add couch_eunit.hrl
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/a33ad578 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/a33ad578 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/a33ad578 Branch: refs/heads/1963-eunit-bigcouch Commit: a33ad5781fa65abd1e7e9e7c78939c079220c728 Parents: 94ae4be Author: Russell Branca <[email protected]> Authored: Fri Aug 15 13:12:06 2014 -0700 Committer: Russell Branca <[email protected]> Committed: Mon Aug 25 13:19:12 2014 -0700 ---------------------------------------------------------------------- include/couch_eunit.hrl | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/a33ad578/include/couch_eunit.hrl ---------------------------------------------------------------------- diff --git a/include/couch_eunit.hrl b/include/couch_eunit.hrl new file mode 100644 index 0000000..83e0d68 --- /dev/null +++ b/include/couch_eunit.hrl @@ -0,0 +1,44 @@ +% Licensed under the Apache License, Version 2.0 (the "License"); you may not +% use this file except in compliance with the License. You may obtain a copy of +% the License at +% +% http://www.apache.org/licenses/LICENSE-2.0 +% +% Unless required by applicable law or agreed to in writing, software +% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +% License for the specific language governing permissions and limitations under +% the License. + +-include_lib("eunit/include/eunit.hrl"). + +-define(BUILDDIR, "/Users/russell/src/couchdb"). +-define(SOURCEDIR, "/Users/russell/src/couchdb/src/couch"). +-define(CONFIG_CHAIN, [ + filename:join([?BUILDDIR, "etc", "couchdb", "default_dev.ini"]), + filename:join([?BUILDDIR, "etc", "couchdb", "local_dev.ini"]), + filename:join([?BUILDDIR, "etc", "couchdb", "eunit.ini"])]). +-define(FIXTURESDIR, + filename:join([?SOURCEDIR, "test", "fixtures"])). +-define(TEMPDIR, + filename:join([?BUILDDIR, "test", "temp"])). + +-define(tempfile, + fun() -> + {A, B, C} = erlang:now(), + N = node(), + FileName = lists:flatten(io_lib:format("~p-~p.~p.~p", [N, A, B, C])), + filename:join([?TEMPDIR, FileName]) + end). +-define(tempdb, + fun() -> + Nums = tuple_to_list(erlang:now()), + Prefix = "eunit-test-db", + Suffix = lists:concat([integer_to_list(Num) || Num <- Nums]), + list_to_binary(Prefix ++ "-" ++ Suffix) + end). +-define(docid, + fun() -> + {A, B, C} = erlang:now(), + lists:flatten(io_lib:format("~p~p~p", [A, B, C])) + end).
