Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mikera committed Dec 5, 2024
1 parent affccc5 commit a16d0d2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion convex-core/src/main/cvx/convex/core/core.cvx
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@
:examples [{:code "(coin-supply)"}]
:signature [{:params []}]}}
([]
(loop [i 0
(loop [i 1
supply 1000000000000000000]
(cond (>= i 8)
supply
Expand Down
11 changes: 7 additions & 4 deletions convex-core/src/test/java/convex/core/data/FuzzTestFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,10 @@ public void fuzzTest() {
}

@Test
public void fuzzExamples() {
public void fuzzExamples() throws BadFormatException {
doCellFuzzTests(Symbols.FOO);

doFuzzTest(Blob.fromHex("31080000000000000034"));
}

public static void doCellFuzzTests(ACell c) {
Expand Down Expand Up @@ -99,10 +101,11 @@ private static void doFuzzTest(Blob b) throws BadFormatException {
}

public static void doMutationTest(Blob b) {
byte[] bs = b.getBytes();
bs[r.nextInt(bs.length)] += (byte) r.nextInt(255);
Blob fuzzed=Blob.wrap(bs);
try {
byte[] bs = b.getBytes();
bs[r.nextInt(bs.length)] += (byte) r.nextInt(255);
doFuzzTest(Blob.wrap(bs));
doFuzzTest(fuzzed);
} catch (BadFormatException e) {
/* OK */
} catch (BufferUnderflowException e) {
Expand Down

0 comments on commit a16d0d2

Please sign in to comment.