This is an automated email from the ASF dual-hosted git repository.

toulmean pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git


The following commit(s) were added to refs/heads/master by this push:
     new ac7a20a  Add test for gossip pruning function
     new 66dad20  Merge pull request #121 from 
atoulme/add_test_for_gossip_pruning_function
ac7a20a is described below

commit ac7a20ada0ad78792163f11d065f2a0850b2ec8f
Author: Antoine Toulme <anto...@lunar-ocean.com>
AuthorDate: Thu Jul 9 00:31:15 2020 -0700

    Add test for gossip pruning function
---
 .../gossip/CountingPeerPruningFunctionTest.java    | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git 
a/gossip/src/test/java/org/apache/tuweni/gossip/CountingPeerPruningFunctionTest.java
 
b/gossip/src/test/java/org/apache/tuweni/gossip/CountingPeerPruningFunctionTest.java
new file mode 100644
index 0000000..448f3f7
--- /dev/null
+++ 
b/gossip/src/test/java/org/apache/tuweni/gossip/CountingPeerPruningFunctionTest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE
+ * file distributed with this work for additional information regarding 
copyright ownership. The ASF licenses this file
+ * to You 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.
+ */
+package org.apache.tuweni.gossip;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.apache.tuweni.plumtree.Peer;
+
+import org.junit.jupiter.api.Test;
+
+class CountingPeerPruningFunctionTest {
+
+  @Test
+  void testPruning() {
+    CountingPeerPruningFunction fn = new CountingPeerPruningFunction(3);
+    Peer peer = new Peer() {};
+    assertFalse(fn.prunePeer(peer));
+    assertFalse(fn.prunePeer(peer));
+    assertTrue(fn.prunePeer(peer));
+
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@tuweni.apache.org
For additional commands, e-mail: commits-h...@tuweni.apache.org

Reply via email to