// Path: src/main/java/org/yaml/snakeyaml/events/Event.java
// public abstract class Event {
//     public enum ID {
//         Alias, DocumentEnd, DocumentStart, MappingEnd, MappingStart, Scalar, SequenceEnd, SequenceStart, StreamEnd, StreamStart
//     }
// 
//     private final Mark startMark;
//     private final Mark endMark;
// 
//     public Event(Mark startMark, Mark endMark) {
//         this.startMark = startMark;
//         this.endMark = endMark;
//     }
// 
//     public String toString() {
//         return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
//     }
// 
//     public Mark getStartMark() {
//         return startMark;
//     }
// 
//     public Mark getEndMark() {
//         return endMark;
//     }
// 
// 
//      // @see "__repr__ for Event in PyYAML"
//     protected String getArguments() {
//         return "";
//     }
// 
//     public abstract boolean is(Event.ID id);
// 
//     /*
//      * for tests only
//      */
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof Event) {
//             return toString().equals(obj.toString());
//         } else {
//             return false;
//         }
//     }
// 
//     /*
//      * for tests only
//      */
//     @Override
//     public int hashCode() {
//         return toString().hashCode();
//     }
// }


import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.yaml.snakeyaml.events.Event;
import org.yaml.snakeyaml.tokens.Token;
        File[] files = getStreamsByExtension(".canonical");
        assertTrue("No test files found.", files.length > 0);
        for (int i = 0; i < files.length; i++) {
            InputStream input = new FileInputStream(files[i]);
            List<Token> tokens = canonicalScan(input);
            input.close();
            assertFalse(tokens.isEmpty());
        }
    }

    private List<Token> canonicalScan(InputStream input) throws IOException {
        int ch = input.read();
        StringBuilder buffer = new StringBuilder();
        while (ch != -1) {
            buffer.append((char) ch);
            ch = input.read();
        }
        CanonicalScanner scanner = new CanonicalScanner(buffer.toString());
        List<Token> result = new ArrayList<Token>();
        while (scanner.peekToken() != null) {
            result.add(scanner.getToken());
        }
        return result;
    }

    public void testCanonicalParser() throws IOException {
        File[] files = getStreamsByExtension(".canonical");
        assertTrue("No test files found.", files.length > 0);
        for (int i = 0; i < files.length; i++) {
            InputStream input = new FileInputStream(files[i]);
// Path: src/main/java/org/yaml/snakeyaml/events/Event.java
// public abstract class Event {
//     public enum ID {
//         Alias, DocumentEnd, DocumentStart, MappingEnd, MappingStart, Scalar, SequenceEnd, SequenceStart, StreamEnd, StreamStart
//     }
// 
//     private final Mark startMark;
//     private final Mark endMark;
// 
//     public Event(Mark startMark, Mark endMark) {
//         this.startMark = startMark;
//         this.endMark = endMark;
//     }
// 
//     public String toString() {
//         return "<" + this.getClass().getName() + "(" + getArguments() + ")>";
//     }
// 
//     public Mark getStartMark() {
//         return startMark;
//     }
// 
//     public Mark getEndMark() {
//         return endMark;
//     }
// 
// 
//      // @see "__repr__ for Event in PyYAML"
//     protected String getArguments() {
//         return "";
//     }
// 
//     public abstract boolean is(Event.ID id);
// 
//     /*
//      * for tests only
//      */
//     @Override
//     public boolean equals(Object obj) {
//         if (obj instanceof Event) {
//             return toString().equals(obj.toString());
//         } else {
//             return false;
//         }
//     }
// 
//     /*
//      * for tests only
//      */
//     @Override
//     public int hashCode() {
//         return toString().hashCode();
//     }
// }


// Path: src/test/java/org/pyyaml/PyCanonicalTest.java
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.yaml.snakeyaml.events.Event;
import org.yaml.snakeyaml.tokens.Token;

        File[] files = getStreamsByExtension(".canonical");
        assertTrue("No test files found.", files.length > 0);
        for (int i = 0; i < files.length; i++) {
            InputStream input = new FileInputStream(files[i]);
            List<Token> tokens = canonicalScan(input);
            input.close();
            assertFalse(tokens.isEmpty());
        }
    }

    private List<Token> canonicalScan(InputStream input) throws IOException {
        int ch = input.read();
        StringBuilder buffer = new StringBuilder();
        while (ch != -1) {
            buffer.append((char) ch);
            ch = input.read();
        }
        CanonicalScanner scanner = new CanonicalScanner(buffer.toString());
        List<Token> result = new ArrayList<Token>();
        while (scanner.peekToken() != null) {
            result.add(scanner.getToken());
        }
        return result;
    }

    public void testCanonicalParser() throws IOException {
        File[] files = getStreamsByExtension(".canonical");
        assertTrue("No test files found.", files.length > 0);
        for (int i = 0; i < files.length; i++) {
            InputStream input = new FileInputStream(files[i]);
            List<Event> tokens = canonicalParse(input);