From 004e1c4e053956731041b35852cd9b2edfbf0a05 Mon Sep 17 00:00:00 2001 From: Mike Date: Tue, 11 Jul 2023 10:06:10 +0100 Subject: [PATCH] More Tests --- convex-core/src/main/java/convex/core/Belief.java | 2 +- convex-core/src/test/java/convex/core/BeliefMergeTest.java | 5 +++++ convex-core/src/test/java/convex/core/data/EncodingTest.java | 3 +-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/convex-core/src/main/java/convex/core/Belief.java b/convex-core/src/main/java/convex/core/Belief.java index 09ce8e7e2..ba6bef77d 100644 --- a/convex-core/src/main/java/convex/core/Belief.java +++ b/convex-core/src/main/java/convex/core/Belief.java @@ -62,7 +62,7 @@ public ACell get(Keyword k) { @Override public Belief updateRefs(IRefFunction func) { - BlobMap> newOrders = Ref.updateRefs(orders, func); + BlobMap> newOrders = orders.updateRefs(func); if (this.orders == newOrders) { return this; } diff --git a/convex-core/src/test/java/convex/core/BeliefMergeTest.java b/convex-core/src/test/java/convex/core/BeliefMergeTest.java index b86fd734f..f88c92b28 100644 --- a/convex-core/src/test/java/convex/core/BeliefMergeTest.java +++ b/convex-core/src/test/java/convex/core/BeliefMergeTest.java @@ -20,6 +20,7 @@ import convex.core.data.Address; import convex.core.data.BlobMap; import convex.core.data.BlobMaps; +import convex.core.data.EncodingTest; import convex.core.data.PeerStatus; import convex.core.data.RecordTest; import convex.core.data.SignedData; @@ -358,6 +359,8 @@ public void testMultiBlockConsensus() throws Exception { assertEquals(TOTAL_VALUE, finalState.computeTotalFunds()); RecordTest.doRecordTests(bs7[0].getBelief()); + + EncodingTest.testFullencoding(finalState); } private boolean allBeliefsEqual(Peer[] pss) { @@ -470,6 +473,8 @@ public void testGossipConsensus() throws Exception { RecordTest.doRecordTests(bs4[0].getBelief()); RecordTest.doRecordTests(finalState); + + EncodingTest.testFullencoding(bs4[0].getBelief()); } private void printAccounts(AVector accounts) { diff --git a/convex-core/src/test/java/convex/core/data/EncodingTest.java b/convex-core/src/test/java/convex/core/data/EncodingTest.java index befcf5097..a4ffe2a0e 100644 --- a/convex-core/src/test/java/convex/core/data/EncodingTest.java +++ b/convex-core/src/test/java/convex/core/data/EncodingTest.java @@ -438,7 +438,7 @@ private T doMultiEncodingTest(ACell a) throws BadFormatExcepti testFullencoding(Samples.INT_LIST_300); } - private void testFullencoding(ACell s) throws BadFormatException { + public static void testFullencoding(ACell s) throws BadFormatException { RefTreeStats rstats = Refs.getRefTreeStats(s.getRef()); Blob b=Format.encodeMultiCell(s); @@ -447,7 +447,6 @@ private void testFullencoding(ACell s) throws BadFormatException { assertEquals(s,s2); RefTreeStats rstats2 = Refs.getRefTreeStats(s2.getRef()); - assertEquals(rstats2.total,rstats2.direct); assertEquals(rstats.total,rstats2.total); } }