aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/MainTest.java53
-rw-r--r--test/core/CommandLineArgumentContainerTest.java26
-rw-r--r--test/core/parser/ParserTest.java31
-rw-r--r--test/core/tokenizer/TokenizerTest.java27
-rw-r--r--test/resources/funcdef.bork8
-rw-r--r--test/resources/program.bork13
-rw-r--r--test/resources/test.file4
7 files changed, 0 insertions, 162 deletions
diff --git a/test/MainTest.java b/test/MainTest.java
deleted file mode 100644
index f90e367..0000000
--- a/test/MainTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package com.jantuomi.interpreter.test;
-
-import com.jantuomi.interpreter.main.Main;
-import com.jantuomi.interpreter.main.exception.InterpreterException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-/**
- * Created by jan on 10.6.2016.
- */
-public class MainTest {
-
- private final ByteArrayOutputStream out = new ByteArrayOutputStream();
- private PrintStream originalOut;
-
- @Before
- public void setupStreams() {
- originalOut = System.out;
- System.setOut(new PrintStream(out));
- }
-
- @After
- public void cleanStreams() {
- System.setOut(originalOut);
- }
-
- @Test
- public void testParseArguments1() {
- String[] notAnArgument = {"--not-an-argument"};
- assertFalse(Main.parseArguments(notAnArgument));
- }
-
- @Test
- public void testParseArguments2() {
- String[] fileTestArgument = {"-f", "test.file"};
- assertTrue(Main.parseArguments(fileTestArgument));
- }
-
- @Test
- public void testWholeProcedure() throws InterpreterException {
- String input = "- + 2 5 1";
-
- Main.run(input);
- assertTrue(out.toString().contains("6"));
- }
-} \ No newline at end of file
diff --git a/test/core/CommandLineArgumentContainerTest.java b/test/core/CommandLineArgumentContainerTest.java
deleted file mode 100644
index f6a6ead..0000000
--- a/test/core/CommandLineArgumentContainerTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.jantuomi.interpreter.test.core;
-
-import com.jantuomi.interpreter.main.core.CommandLineArgumentContainer;
-import com.jantuomi.interpreter.main.utils.Utilities;
-import org.junit.Test;
-
-import java.io.File;
-
-import static org.junit.Assert.assertTrue;
-
-/**
- * Created by jan on 10.6.2016.
- */
-public class CommandLineArgumentContainerTest {
- @Test
- public void getSourceFileContents() throws Exception {
- CommandLineArgumentContainer c = CommandLineArgumentContainer.getInstance();
-
- File basePath = new File(Utilities.getBasePath());
- c.setFile(new File(basePath, "src/com/jantuomi/interpreter/test/resources/test.file"));
- String contents = c.getSourceFileContents();
- System.out.println(contents);
- assertTrue(contents.contains("###"));
- }
-
-} \ No newline at end of file
diff --git a/test/core/parser/ParserTest.java b/test/core/parser/ParserTest.java
deleted file mode 100644
index 9dc51e3..0000000
--- a/test/core/parser/ParserTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package com.jantuomi.interpreter.test.core.parser;
-
-import com.jantuomi.interpreter.main.core.parser.Parser;
-import com.jantuomi.interpreter.main.core.tokenizer.token.Token;
-import com.jantuomi.interpreter.main.core.tokenizer.token.types.AdditionToken;
-import com.jantuomi.interpreter.main.core.tokenizer.token.types.IntegerLiteralToken;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * Created by jan on 12.6.2016.
- */
-public class ParserTest {
-
- @Test
- public void testParseAddition() throws Exception {
- List<Token> tokens = Arrays.asList(
- new IntegerLiteralToken("1"),
- new IntegerLiteralToken("2"),
- new AdditionToken()
- );
-
- Parser parser = Parser.getInstance();
- List<Token> sequence = parser.parse(tokens);
- for (Token t : sequence) {
- parser.printTree(t);
- }
- }
-} \ No newline at end of file
diff --git a/test/core/tokenizer/TokenizerTest.java b/test/core/tokenizer/TokenizerTest.java
deleted file mode 100644
index 4274a93..0000000
--- a/test/core/tokenizer/TokenizerTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-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")));
- }
-} \ No newline at end of file
diff --git a/test/resources/funcdef.bork b/test/resources/funcdef.bork
deleted file mode 100644
index 8412129..0000000
--- a/test/resources/funcdef.bork
+++ /dev/null
@@ -1,8 +0,0 @@
-/* kommentti juu jee */
-
-func my_func x y as
- + x 1
- - y x
-end
-
-my_func(1 2) \ No newline at end of file
diff --git a/test/resources/program.bork b/test/resources/program.bork
deleted file mode 100644
index 7034625..0000000
--- a/test/resources/program.bork
+++ /dev/null
@@ -1,13 +0,0 @@
-/* get an integer from the user */
-decl lhs decl rhs
-set lhs in("give an integer: ")
-set rhs in("give another: ")
-
-/* add the inputs together */
-decl sum
-set sum + as_int(lhs) as_int(rhs)
-
-/* print the sum */
-out( concat(lhs " + " rhs " = " sum) )
-
-"done" \ No newline at end of file
diff --git a/test/resources/test.file b/test/resources/test.file
deleted file mode 100644
index 3b723c0..0000000
--- a/test/resources/test.file
+++ /dev/null
@@ -1,4 +0,0 @@
-###
-This test file starts and
-ends in three # symbols
-### \ No newline at end of file