aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/com/jogamp/gluegen/jcpp/PragmaTest.java
blob: 8c82743d7823e800774cfd46500d3b5db7c8ac9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jogamp.gluegen.jcpp;

import com.google.common.base.Charsets;
import com.google.common.io.CharSource;
import com.google.common.io.CharStreams;
import com.google.common.io.Files;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;

import org.junit.Test;
import com.jogamp.gluegen.Logging;
import com.jogamp.gluegen.Logging.LoggerIf;
import com.jogamp.gluegen.test.junit.generation.BuildEnvironment;
import com.jogamp.junit.util.SingletonJunitCase;
import static org.junit.Assert.*;

/**
 *
 * @author shevek
 */
public class PragmaTest extends SingletonJunitCase {

    private static final LoggerIf LOG = Logging.getLogger(PragmaTest.class);

    @Test
    public void testPragma() throws Exception {
        LOG.setLevel(Level.INFO);
        final File file = new File(BuildEnvironment.gluegenRoot+"/jcpp/src/test/resources/pragma.c");
        assertTrue(file.exists());

        final CharSource source = Files.asCharSource(file, Charsets.UTF_8);
        final CppReader r = new CppReader(source.openBufferedStream());
        r.getPreprocessor().setListener(new DefaultPreprocessorListener());
        final String output = CharStreams.toString(r);
        r.close();
        LOG.info("Output: " + output);
        // assertTrue(output.contains("absolute-result"));
    }

    public static void main(final String args[]) throws IOException {
        final String tstname = PragmaTest.class.getName();
        org.junit.runner.JUnitCore.main(tstname);
    }
}