Open ept opened 3 years ago
Do you have a strategy in mind for this, @ept? Seems like a fun little project to experiment with.
I had in mind the following approach, which tests only the backend, not the frontend (I think that's good because it allows the same fuzz tests to be run against both JS and wasm backends, and it avoids having to fiddle around with the proxies stuff in the frontend):
Backend.applyLocalChange
to binary-encode it, and enqueue it as a future change to apply on the other nodes. Keep a separate queue for every source node so that different nodes may apply the same changes in different orders if they come from different nodes.Backend.load(Backend.save(doc))
works (throws an exception if we are not able to reconstruct the verbatim original change history from the compressed document), and that Backend.getPatch(doc)
restores the same document state as before the save()
.
Even though we already have a solid suite of unit tests with near-complete coverage, fuzz testing with large numbers of pseudorandomly generated inputs would provide further reassurance, especially when switching to the new data structures that have lots of opportunities for subtle bugs.
A while ago I already wrote a minimal CRDT implementation with the intention of providing a test oracle that gives the expected answer. However, I have not yet written the test case generator and the test execution logic.