aboutsummaryrefslogtreecommitdiffstats
path: root/test/core/tokenizer/TokenizerTest.java
blob: 4274a930fa69834723785e316821ac9e766342e7 (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
package com.jantuomi.interpreter.test.core.tokenizer;

import com.jantuomi.interpreter.main.core.tokenizer.Tokenizer;
import com.jantuomi.interpreter.main.core.tokenizer.token.Token;
import com.jantuomi.interpreter.main.core.tokenizer.token.types.IntegerLiteralToken;
import com.jantuomi.interpreter.main.exception.InterpreterException;
import org.junit.Test;

import java.util.List;

import static org.junit.Assert.assertTrue;

/**
 * Created by jan on 10.6.2016.
 */
public class TokenizerTest {

    @Test
    public void testAddition() throws InterpreterException {
        String testString = "1 2 +";
        List<Token> list = Tokenizer.getInstance().tokenize(testString);

        System.out.println(String.format("test string:\n%s", testString));
        Tokenizer.printTokens(list);
        assertTrue(list.contains(new IntegerLiteralToken("2")));
    }
}