Skip to content

Commit

Permalink
More Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Jul 11, 2023
1 parent 0a69331 commit 004e1c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion convex-core/src/main/java/convex/core/Belief.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public ACell get(Keyword k) {

@Override
public Belief updateRefs(IRefFunction func) {
BlobMap<AccountKey, SignedData<Order>> newOrders = Ref.updateRefs(orders, func);
BlobMap<AccountKey, SignedData<Order>> newOrders = orders.updateRefs(func);
if (this.orders == newOrders) {
return this;
}
Expand Down
5 changes: 5 additions & 0 deletions convex-core/src/test/java/convex/core/BeliefMergeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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<AccountStatus> accounts) {
Expand Down
3 changes: 1 addition & 2 deletions convex-core/src/test/java/convex/core/data/EncodingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ private <T extends ACell> 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);

Expand All @@ -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);
}
}

0 comments on commit 004e1c4

Please sign in to comment.