package xyz.jadonfowler.o.test;

import static org.junit.Assert.assertEquals;

import xyz.jadonfowler.o.O;
import org.junit.Test;

public class TestSuite {

    private O o;

    @Test
    public void testOParsing() {
        o = new O();
        O.instance = o;
        //assertEquals("", parse(""), "");
        assertEquals("12+o -> 3", parse("12+o"), "3");
        assertEquals("\"Hello World\"o -> Hello World", parse("\"Hello World\"o"), "Hello World");
        assertEquals("[123]+o -> 6", parse("[123]+o"), "6");
        assertEquals("[12] (4]*o -> 8", parse("[12] (4]*o"), "8");
        assertEquals("[3,]2^+o -> 14", parse("[3,]2^+o"), "14");
    }

    public String parse(String s) {
        String result = "";
        for (char c : s.toCharArray()) {
            try {
                result += o.parse(c);
            } catch(Exception e) {}
        }
        return result;
    }

}

@@ -122,16 +122,41 @@
 it.Test;
+%0Aimport org.junit.Before;
 %0A%0Apublic
@@ -198,20 +198,22 @@
 ;%0A%0A    @
-Test
+Before
 %0A    pub
@@ -225,20 +225,13 @@
 oid 
-testOParsing
+setUp
 () %7B
@@ -276,16 +276,66 @@
 ce = o;%0A
+    %7D%0A%0A    @Test%0A    public void testOParsing() %7B%0A
         

put O init into @Before