forked from jahin07/compiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathASTTest.java
39 lines (29 loc) · 995 Bytes
/
ASTTest.java
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
package cop5556sp17;
import static cop5556sp17.Scanner.Kind.*;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import cop5556sp17.Parser.SyntaxException;
import cop5556sp17.Scanner.IllegalCharException;
import cop5556sp17.Scanner.IllegalNumberException;
import cop5556sp17.Scanner.Kind;
import cop5556sp17.AST.*;
public class ASTTest {
static final boolean doPrint = true;
static void show(Object s){
if(doPrint){System.out.println(s);}
}
@Rule
public ExpectedException thrown = ExpectedException.none();
@Test
public void testFactor0() throws IllegalCharException, IllegalNumberException, SyntaxException {
String input = "abc";
Scanner scanner = new Scanner(input);
scanner.scan();
Parser parser = new Parser(scanner);
ASTNode ast = parser.expression();
assertEquals(IdentExpression.class, ast.getClass());
}
}