Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C788311D08 for ; Fri, 29 Aug 2014 20:43:04 +0000 (UTC) Received: (qmail 81617 invoked by uid 500); 29 Aug 2014 20:43:04 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 81362 invoked by uid 500); 29 Aug 2014 20:43:04 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 80467 invoked by uid 99); 29 Aug 2014 20:43:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Aug 2014 20:43:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CD3329A8D49; Fri, 29 Aug 2014 20:43:03 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chewbranca@apache.org To: commits@couchdb.apache.org Date: Fri, 29 Aug 2014 20:43:28 -0000 Message-Id: <9ac2e97782184b109cf1e48f5611c517@git.apache.org> In-Reply-To: <455b2bf437ec4190a337b5785b95de93@git.apache.org> References: <455b2bf437ec4190a337b5785b95de93@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [26/50] [abbrv] couch commit: updated refs/heads/1963-eunit-bigcouch to 08c6f0b Delete tests for the no longer present couch_ref_counter.erl Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/c96d24ed Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/c96d24ed Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/c96d24ed Branch: refs/heads/1963-eunit-bigcouch Commit: c96d24ed3ceb10c15cb276d8aa1502912643c668 Parents: c6afffe Author: Russell Branca Authored: Wed Aug 13 14:24:28 2014 -0700 Committer: Russell Branca Committed: Fri Aug 29 13:42:25 2014 -0700 ---------------------------------------------------------------------- test/couch_ref_counter_tests.erl | 107 ---------------------------------- 1 file changed, 107 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/c96d24ed/test/couch_ref_counter_tests.erl ---------------------------------------------------------------------- diff --git a/test/couch_ref_counter_tests.erl b/test/couch_ref_counter_tests.erl deleted file mode 100644 index 0217623..0000000 --- a/test/couch_ref_counter_tests.erl +++ /dev/null @@ -1,107 +0,0 @@ -% 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. - --module(couch_ref_counter_tests). - --include_lib("couch/include/couch_eunit.hrl"). --include_lib("couch/include/couch_db.hrl"). - --define(TIMEOUT, 1000). - - -setup() -> - {ok, RefCtr} = couch_ref_counter:start([]), - ChildPid = spawn(fun() -> loop() end), - {RefCtr, ChildPid}. - -teardown({_, ChildPid}) -> - erlang:monitor(process, ChildPid), - ChildPid ! close, - wait(). - - -couch_ref_counter_test_() -> - { - "CouchDB reference counter tests", - { - foreach, - fun setup/0, fun teardown/1, - [ - fun should_initialize_with_calling_process_as_referrer/1, - fun should_ignore_unknown_pid/1, - fun should_increment_counter_on_pid_add/1, - fun should_not_increase_counter_on_readding_same_pid/1, - fun should_drop_ref_for_double_added_pid/1, - fun should_decrement_counter_on_pid_drop/1, - fun should_add_after_drop/1, - fun should_decrement_counter_on_process_exit/1 - - ] - } - }. - - -should_initialize_with_calling_process_as_referrer({RefCtr, _}) -> - ?_assertEqual(1, couch_ref_counter:count(RefCtr)). - -should_ignore_unknown_pid({RefCtr, ChildPid}) -> - ?_assertEqual(ok, couch_ref_counter:drop(RefCtr, ChildPid)). - -should_increment_counter_on_pid_add({RefCtr, ChildPid}) -> - couch_ref_counter:add(RefCtr, ChildPid), - ?_assertEqual(2, couch_ref_counter:count(RefCtr)). - -should_not_increase_counter_on_readding_same_pid({RefCtr, ChildPid}) -> - couch_ref_counter:add(RefCtr, ChildPid), - couch_ref_counter:add(RefCtr, ChildPid), - ?_assertEqual(2, couch_ref_counter:count(RefCtr)). - -should_drop_ref_for_double_added_pid({RefCtr, ChildPid}) -> - couch_ref_counter:add(RefCtr, ChildPid), - couch_ref_counter:add(RefCtr, ChildPid), - couch_ref_counter:drop(RefCtr, ChildPid), - ?_assertEqual(2, couch_ref_counter:count(RefCtr)). - -should_decrement_counter_on_pid_drop({RefCtr, ChildPid}) -> - couch_ref_counter:add(RefCtr, ChildPid), - couch_ref_counter:drop(RefCtr, ChildPid), - ?_assertEqual(1, couch_ref_counter:count(RefCtr)). - -should_add_after_drop({RefCtr, ChildPid}) -> - couch_ref_counter:add(RefCtr, ChildPid), - couch_ref_counter:drop(RefCtr, ChildPid), - couch_ref_counter:add(RefCtr, ChildPid), - ?_assertEqual(2, couch_ref_counter:count(RefCtr)). - -should_decrement_counter_on_process_exit({RefCtr, ChildPid}) -> - ?_assertEqual(1, - begin - couch_ref_counter:add(RefCtr, ChildPid), - erlang:monitor(process, ChildPid), - ChildPid ! close, - wait(), - couch_ref_counter:count(RefCtr) - end). - - -loop() -> - receive - close -> ok - end. - -wait() -> - receive - {'DOWN', _, _, _, _} -> - ok - after ?TIMEOUT -> - throw(timeout_error) - end.