// Path: src/org/udalov/jclang/structs/CXCursor.java
// @SuppressWarnings("unused")
// public class CXCursor extends Structure {
//     public int kind;
//     public int xdata;
//     public Pointer[] data = new Pointer[3];
// 
//     public CXCursor() {
//         super();
//         setFieldOrder(new String[]{"kind", "xdata", "data"});
//     }
//     
//     public static class ByValue extends CXCursor implements Structure.ByValue {}
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum DisplayOptions {
//     DISPLAY_SOURCE_LOCATION,
//     DISPLAY_COLUMN,
//     DISPLAY_SOURCE_RANGES,
//     DISPLAY_OPTION,
//     DISPLAY_CATEGORY_ID,
//     DISPLAY_CATEGORY_NAME
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum Severity {
//     IGNORED,
//     NOTE,
//     WARNING,
//     ERROR,
//     FATAL
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum Severity {
//     IGNORED,
//     NOTE,
//     WARNING,
//     ERROR,
//     FATAL
// }
// 
// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


import org.jetbrains.annotations.NotNull;
import org.udalov.jclang.structs.CXCursor;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.udalov.jclang.Diagnostic.DisplayOptions.*;
import static org.udalov.jclang.Diagnostic.Severity;
import static org.udalov.jclang.Diagnostic.Severity.*;
import static org.udalov.jclang.TestUtils.createOrCompare;
    public void testParseTranslationUnit() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        index.parseTranslationUnit(TestUtils.createTempFileWithContents("").getAbsolutePath(), new String[]{});
    }

    public void testTranslationException() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        try {
            index.parseTranslationUnit(null, new String[]{});
        } catch (TranslationException e) {
            return;
        }
        fail("TranslationException expected");
    }

    public void testDiagnosticDisplayOptions() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        TranslationUnit unit = index.parseTranslationUnit(getDir() + "diagnosticDisplayOptions.h", new String[]{});
        List<Diagnostic> diagnostics = unit.getDiagnostics();
        assertEquals(1, diagnostics.size());
        Diagnostic diagnostic = diagnostics.iterator().next();
        StringWriter sw = new StringWriter();
        PrintWriter out = new PrintWriter(sw);
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION));
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION, DISPLAY_COLUMN));
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION, DISPLAY_SOURCE_RANGES));
        out.println(diagnostic.format(DISPLAY_OPTION));
        out.println(diagnostic.format(DISPLAY_CATEGORY_ID));
        out.println(diagnostic.format(DISPLAY_CATEGORY_NAME));
        out.close();
// Path: src/org/udalov/jclang/structs/CXCursor.java
// @SuppressWarnings("unused")
// public class CXCursor extends Structure {
//     public int kind;
//     public int xdata;
//     public Pointer[] data = new Pointer[3];
// 
//     public CXCursor() {
//         super();
//         setFieldOrder(new String[]{"kind", "xdata", "data"});
//     }
//     
//     public static class ByValue extends CXCursor implements Structure.ByValue {}
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum DisplayOptions {
//     DISPLAY_SOURCE_LOCATION,
//     DISPLAY_COLUMN,
//     DISPLAY_SOURCE_RANGES,
//     DISPLAY_OPTION,
//     DISPLAY_CATEGORY_ID,
//     DISPLAY_CATEGORY_NAME
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum Severity {
//     IGNORED,
//     NOTE,
//     WARNING,
//     ERROR,
//     FATAL
// }
// 
// Path: src/org/udalov/jclang/Diagnostic.java
// public enum Severity {
//     IGNORED,
//     NOTE,
//     WARNING,
//     ERROR,
//     FATAL
// }
// 
// Path: tests/org/udalov/jclang/TestUtils.java
// public static void createOrCompare(@NotNull String actual, @NotNull String expectedFileName) {
//     try {
//         String expected = loadFileContents(expectedFileName);
//         assertEquals(expected, actual);
//     }
//     catch (IOException e) {
//         try {
//             PrintWriter out = new PrintWriter(new File(expectedFileName));
//             out.print(actual);
//             out.close();
//             assertEquals("Expected file wasn't found, it will be created", "", actual);
//         }
//         catch (IOException ee) {
//             ee.printStackTrace();
//             fail(ee.getMessage());
//         }
//     }
// }


// Path: tests/org/udalov/jclang/BasicTest.java
import org.jetbrains.annotations.NotNull;
import org.udalov.jclang.structs.CXCursor;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.udalov.jclang.Diagnostic.DisplayOptions.*;
import static org.udalov.jclang.Diagnostic.Severity;
import static org.udalov.jclang.Diagnostic.Severity.*;
import static org.udalov.jclang.TestUtils.createOrCompare;

    public void testParseTranslationUnit() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        index.parseTranslationUnit(TestUtils.createTempFileWithContents("").getAbsolutePath(), new String[]{});
    }

    public void testTranslationException() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        try {
            index.parseTranslationUnit(null, new String[]{});
        } catch (TranslationException e) {
            return;
        }
        fail("TranslationException expected");
    }

    public void testDiagnosticDisplayOptions() {
        Index index = Clang.INSTANCE.createIndex(false, false);
        TranslationUnit unit = index.parseTranslationUnit(getDir() + "diagnosticDisplayOptions.h", new String[]{});
        List<Diagnostic> diagnostics = unit.getDiagnostics();
        assertEquals(1, diagnostics.size());
        Diagnostic diagnostic = diagnostics.iterator().next();
        StringWriter sw = new StringWriter();
        PrintWriter out = new PrintWriter(sw);
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION));
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION, DISPLAY_COLUMN));
        out.println(diagnostic.format(DISPLAY_SOURCE_LOCATION, DISPLAY_SOURCE_RANGES));
        out.println(diagnostic.format(DISPLAY_OPTION));
        out.println(diagnostic.format(DISPLAY_CATEGORY_ID));
        out.println(diagnostic.format(DISPLAY_CATEGORY_NAME));
        out.close();
        createOrCompare(sw.toString(), getDir() + "diagnosticDisplayOptions.txt");