public void testEquivalence() throws OperationException, TransformException {
Random r = new Random(0);
DocOpGenerator generator = new DocOpGenerator();
for (int iteration = 0; iteration < NUM_ITERATIONS; ++iteration) {
System.out.println("Iteration: " + iteration);
BootstrapDocument document= new BootstrapDocument();
for (int i = 0; i < INITIAL_MUTATION_COUNT; ++i) {
document.consume(generator.randomOperation(document, r));
}
for (int i = 0; i < FEATURE_ITERATION_COUNT; ++i) {
DocOp clientOp = generator.randomOperation(document, r);
DocOp serverOp = generator.randomOperation(document, r);
OperationPair<DocOp> pair = Transformer.transform(clientOp, serverOp);
OperationPair<DocOp> referencePair =
ReferenceTransformer.transform(clientOp, serverOp);
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
pair.clientOp(), referencePair.clientOp()));
assertTrue(OpComparators.SYNTACTIC_IDENTITY.equal(
pair.serverOp(), referencePair.serverOp()));
document.consume(clientOp);
document.consume(pair.serverOp());
}
}
}