-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More generative tests for ops and transactions
- Loading branch information
Showing
5 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package convex.core.cvm; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
import org.junit.runner.RunWith; | ||
|
||
import com.pholser.junit.quickcheck.From; | ||
import com.pholser.junit.quickcheck.Property; | ||
import com.pholser.junit.quickcheck.runner.JUnitQuickcheck; | ||
|
||
import convex.core.init.InitTest; | ||
import convex.test.generators.OpsGen; | ||
|
||
@RunWith(JUnitQuickcheck.class) | ||
public class GenTestOps { | ||
|
||
@SuppressWarnings("rawtypes") | ||
@Property | ||
public void testOpExecution(@From(OpsGen.class) AOp op) { | ||
// A context should be able to execute any valid Op without throwing | ||
Context c=Context.create(InitTest.STATE); | ||
long initialJuice=c.getJuiceUsed(); | ||
assertEquals(0,initialJuice); | ||
c=c.execute(op); | ||
assertEquals(0,c.getDepth()); | ||
|
||
assertTrue(c.getJuiceUsed()>initialJuice); | ||
|
||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters