IndexedDocumentImpl<Node, Element, Text, ?> doc =
new IndexedDocumentImpl<Node, Element, Text, Void>(
RawDocumentImpl.PROVIDER.parse("<doc><p></p></doc>"), annotations,
DocumentSchema.NO_SCHEMA_CONSTRAINTS);
doc.consume(new DocOpBuilder().annotationBoundary(
new AnnotationBoundaryMapBuilder().change("a", null, "0").build())
.characters(b.toString()).retain(2)
.annotationBoundary(new AnnotationBoundaryMapBuilder().end("a").build()).build());
long startTime = System.currentTimeMillis();
final int reps = 10000;
for (int i = 0; i < reps; i++) {
assertTrue(
// The test is that this doesn't time out.
DocOpValidator.validate(null, DocumentSchema.NO_SCHEMA_CONSTRAINTS,
Automatons.fromReadable(doc),
new DocOpBuilder().annotationBoundary(
new AnnotationBoundaryMapBuilder().change("a", "0", "1").build())
.retain(length + 2)
.annotationBoundary(new AnnotationBoundaryMapBuilder().end("a").build()).build())
.isValid());
}
long endTime = System.currentTimeMillis();
long elapsed = endTime - startTime;
System.err.println("millis per rep: " + (((float) elapsed) / reps));