-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestTemplate.java
More file actions
58 lines (47 loc) · 1.85 KB
/
Copy pathTestTemplate.java
File metadata and controls
58 lines (47 loc) · 1.85 KB
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
51
52
53
54
55
56
57
58
import de.unituebingen.compilerbau.CompilerTest;
import de.unituebingen.compilerbau.ast.AccessModifier;
import de.unituebingen.compilerbau.ast.Clazz;
import de.unituebingen.compilerbau.exception.ASTException;
import de.unituebingen.compilerbau.exception.TypeCheckException;
import de.unituebingen.compilerbau.scanner.ScannerParser;
import de.unituebingen.compilerbau.typing.TypeChecker;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class TestTemplate extends CompilerTest {
@Override
public String getMockFilePath() {
return "/MockFolder/MockTemplate.java";
}
@Override
public Map<String, Clazz> getExpectedClassMap() {
final Clazz expectedAST = new Clazz(
AccessModifier.PUBLIC,
"MockTemplate",
Collections.emptyList(),
Collections.emptyList());
// TODO: Add AST
Map<String, Clazz> classMap = new HashMap<>();
classMap.put(expectedAST.name, expectedAST);
return classMap;
}
@Override
public void testAST() throws ASTException {
final ScannerParser scannerParser = new ScannerParser();
Map<String, Clazz> resultMap = scannerParser.parse(this.getSourcecode());
assertEquals(getExpectedClassMap().get("MockTemplate"), resultMap.get("MockTemplate"));
}
@Override
public void testTypeCheckedAST() throws TypeCheckException {
TypeChecker typeChecker = new TypeChecker();
typeChecker.check(getExpectedClassMap());
}
@Override
public void testGeneratedBytecode() throws IOException, CloneNotSupportedException, ClassNotFoundException {
compileAndLoadClasses();
Class c = this.compiledClasses.get("MockTemplate");
// TODO: Add code gen tests
}
}