Browse Source

Merge branch 'master' of github.com:esl/gproc

Ulf Wiger 13 years ago
parent
commit
6386726301
4 changed files with 27 additions and 5 deletions
  1. 1 1
      doc/gproc_dist.md
  2. 1 1
      src/gproc.app.src
  3. 3 3
      test/gproc_dist_tests.erl
  4. 22 0
      test/gproc_tests.erl

+ 1 - 1
doc/gproc_dist.md

@@ -13,7 +13,7 @@ Extended process registry.
 
 
 
 
 
 
-__Behaviours:__ [`gen_leader`](/Users/uwiger/ETC/git/gproc/deps/gen_leader/doc/gen_leader.md).
+__Behaviours:__ [`gen_leader`](/Users/uwiger/tmp/gproc/deps/gen_leader/doc/gen_leader.md).
 
 
 __Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)).
 __Authors:__ Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)).
 
 

+ 1 - 1
src/gproc.app.src

@@ -5,7 +5,7 @@
 {application, gproc,
 {application, gproc,
  [
  [
   {description, "GPROC"},
   {description, "GPROC"},
-  {vsn, "0.2.8"},
+  {vsn, "0.2.9"},
   {id, "GPROC"},
   {id, "GPROC"},
   {registered, [ ] },
   {registered, [ ] },
   %% NOTE: do not list applications which are load-only!
   %% NOTE: do not list applications which are load-only!

+ 3 - 3
test/gproc_dist_tests.erl

@@ -3,18 +3,18 @@
 %% compliance with the License. You should have received a copy of the
 %% compliance with the License. You should have received a copy of the
 %% Erlang Public License along with this software. If not, it can be
 %% Erlang Public License along with this software. If not, it can be
 %% retrieved via the world wide web at http://www.erlang.org/.
 %% retrieved via the world wide web at http://www.erlang.org/.
-%% 
+%%
 %% Software distributed under the License is distributed on an "AS IS"
 %% Software distributed under the License is distributed on an "AS IS"
 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
 %% the License for the specific language governing rights and limitations
 %% the License for the specific language governing rights and limitations
 %% under the License.
 %% under the License.
-%% 
+%%
 %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
 %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.
 %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
 %% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings
 %% AB. All Rights Reserved.''
 %% AB. All Rights Reserved.''
 %%
 %%
 %% @author Ulf Wiger <ulf.wiger@erlang-solutions.com>
 %% @author Ulf Wiger <ulf.wiger@erlang-solutions.com>
-%% 
+%%
 -module(gproc_dist_tests).
 -module(gproc_dist_tests).
 
 
 -ifdef(TEST).
 -ifdef(TEST).

+ 22 - 0
test/gproc_tests.erl

@@ -95,6 +95,8 @@ reg_test_() ->
       , ?_test(t_is_clean())
       , ?_test(t_is_clean())
       , {spawn, ?_test(t_select())}
       , {spawn, ?_test(t_select())}
       , ?_test(t_is_clean())
       , ?_test(t_is_clean())
+      , {spawn, ?_test(t_select_count())}
+      , ?_test(t_is_clean())
       , {spawn, ?_test(t_qlc())}
       , {spawn, ?_test(t_qlc())}
       , ?_test(t_is_clean())
       , ?_test(t_is_clean())
       , {spawn, ?_test(t_get_env())}
       , {spawn, ?_test(t_get_env())}
@@ -292,6 +294,26 @@ t_select() ->
 	    {all,all},
 	    {all,all},
 	    [{{'_',self(),'_'},[],['$_']}])).
 	    [{{'_',self(),'_'},[],['$_']}])).
 
 
+t_select_count() ->
+    ?assertEqual(true, gproc:reg({n, l, {n,1}}, x)),
+    ?assertEqual(true, gproc:reg({n, l, {n,2}}, y)),
+    ?assertEqual(true, gproc:reg({p, l, {p,1}}, x)),
+    ?assertEqual(true, gproc:reg({p, l, {p,2}}, y)),
+    ?assertEqual(true, gproc:reg({c, l, {c,1}}, 1)),
+    ?assertEqual(true, gproc:reg({a, l, {c,1}}, undefined)),
+    %% local names
+    ?assertEqual(2, gproc:select_count(
+		      {local,names}, [{{{n,l,'_'},'_','_'},[],[true]}])),
+    %% mactch local names on value
+    ?assertEqual(1, gproc:select_count(
+		      {local,names}, [{{{n,l,'_'},'_',x},[],[true]}])),
+    %% match all on value
+    ?assertEqual(2, gproc:select_count(
+		      {all,all}, [{{{'_',l,'_'},'_',x},[],[true]}])),
+    %% match all on pid
+    ?assertEqual(6, gproc:select_count(
+		      {all,all}, [{{'_',self(),'_'},[],[true]}])).
+
 t_qlc() ->
 t_qlc() ->
     ?assertEqual(true, gproc:reg({n, l, {n,1}}, x)),
     ?assertEqual(true, gproc:reg({n, l, {n,1}}, x)),
     ?assertEqual(true, gproc:reg({n, l, {n,2}}, y)),
     ?assertEqual(true, gproc:reg({n, l, {n,2}}, y)),