1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package com.github.maven_nar.cpptasks.compiler;
21
22 import junit.framework.TestCase;
23
24 import com.github.maven_nar.cpptasks.CCTask;
25 import com.github.maven_nar.cpptasks.ProcessorDef;
26 import com.github.maven_nar.cpptasks.VersionInfo;
27
28
29
30
31
32
33 public class TestAbstractProcessor extends TestCase {
34 private class DummyAbstractProcessor extends AbstractProcessor {
35 public DummyAbstractProcessor() {
36 super(new String[] {
37 ".cpp", ".c"
38 }, new String[] {
39 ".hpp", ".h", ".inl"
40 });
41 }
42
43 @Override
44 public ProcessorConfiguration createConfiguration(final CCTask task, final LinkType linkType,
45 final ProcessorDef[] defaultProvider, final ProcessorDef specificProvider,
46 final com.github.maven_nar.cpptasks.TargetDef targetPlatform, final VersionInfo versionInfo) {
47 return null;
48 }
49
50 @Override
51 public String getIdentifier() {
52 return "dummy";
53 }
54
55 @Override
56 public Linker getLinker(final LinkType type) {
57 return null;
58 }
59
60 @Override
61 public String[] getOutputFileNames(final String sourceFile, final VersionInfo versionInfo) {
62 return new String[0];
63 }
64
65 public String[][] getRuntimeLibraries(final boolean debug, final boolean multithreaded, final boolean staticLink) {
66 return new String[2][0];
67 }
68 }
69
70 public TestAbstractProcessor(final String name) {
71 super(name);
72 }
73
74 protected AbstractProcessor create() {
75 return new DummyAbstractProcessor();
76 }
77
78 public void failingtestBid() {
79 final AbstractProcessor compiler = create();
80 int bid = compiler.bid("c:/foo\\bar\\hello.c");
81 assertEquals(100, bid);
82 bid = compiler.bid("c:/foo\\bar/hello.c");
83 assertEquals(100, bid);
84 bid = compiler.bid("c:/foo\\bar\\hello.h");
85 assertEquals(1, bid);
86 bid = compiler.bid("c:/foo\\bar/hello.h");
87 assertEquals(1, bid);
88 bid = compiler.bid("c:/foo\\bar/hello.pas");
89 assertEquals(0, bid);
90 bid = compiler.bid("c:/foo\\bar/hello.java");
91 assertEquals(0, bid);
92 }
93
94 public void testGetIdentfier() {
95 final AbstractProcessor compiler = create();
96 final String id = compiler.getIdentifier();
97 assertEquals("dummy", id);
98 }
99 }