package org.cafebabepy.evaluter.Interpret;

import org.cafebabepy.runtime.PyObject;
import org.cafebabepy.runtime.Python;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

public class InterpretEvaluatorTest {

    @Nested
    class Literal {
        @Test
        void integer() {
            PyObject result = Python.eval("99");

            assertEquals((int) result.toJava(Integer.class), 99);
        }

        @Test
        void stringSingle() {
            PyObject result = Python.eval("'abc'");

            assertEquals(result.toJava(String.class), "abc");
        }

        @Test
        void stringDouble() {
            PyObject result = Python.eval("\"abc\"");

            assertEquals(result.toJava(String.class), "abc");
        }
    }
}

@@ -184,24 +184,155 @@
 .api.Test;%0A%0A
+import java.io.ByteArrayOutputStream;%0Aimport java.io.IOException;%0Aimport java.io.PrintStream;%0Aimport java.util.function.Consumer;%0A%0A
 import stati
@@ -964,11 +964,1978 @@
  %7D%0A    %7D
+%0A%0A    @Nested%0A    class If %7B%0A        @Test%0A        void ifTrue() throws IOException %7B%0A            evalStdOutToResult(%22%22%0A                    + %22if 1 == 1:%5Cn%22%0A                    + %22  print('cafe')%22, result -%3E %7B%0A                assertEquals(result, %22cafe%22 + System.lineSeparator());%0A            %7D);%0A        %7D%0A%0A        @Test%0A        void ifFalse() throws IOException %7B%0A            evalStdOutToResult(%22%22%0A                    + %22if 1 != 1:%5Cn%22%0A                    + %22  print('cafe')%5Cn%22%0A                    + %22print('babe')%22, result -%3E %7B%0A                assertEquals(result, %22babe%22 + System.lineSeparator());%0A            %7D);%0A        %7D%0A%0A        @Test%0A        void ifTrueElse() throws IOException %7B%0A            evalStdOutToResult(%22%22%0A                    + %22if 1 == 1:%5Cn%22%0A                    + %22  print('cafe')%5Cn%22%0A                    + %22else:%5Cn%22%0A                    + %22  print('babe')%22, result -%3E %7B%0A                assertEquals(result, %22cafe%22 + System.lineSeparator());%0A            %7D);%0A        %7D%0A%0A        @Test%0A        void ifFalseElse() throws IOException %7B%0A            evalStdOutToResult(%22%22%0A                    + %22if 1 != 1:%5Cn%22%0A                    + %22  print('cafe')%5Cn%22%0A                    + %22else:%5Cn%22%0A                    + %22  print('babe')%22, result -%3E %7B%0A                assertEquals(result, %22babe%22 + System.lineSeparator());%0A            %7D);%0A        %7D%0A    %7D%0A%0A    private void evalStdOutToResult(String input, Consumer%3CString%3E consumer) throws IOException %7B%0A        try (%0A                ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();%0A                PrintStream out = new PrintStream(byteArrayOut)) %7B%0A%0A            PrintStream defaultOut = System.out;%0A            System.setOut(out);%0A            try %7B%0A                Python.eval(input);%0A%0A                String result = new String(byteArrayOut.toByteArray(), %22UTF-8%22);%0A%0A                consumer.accept(result);%0A%0A            %7D finally %7B%0A                System.setOut(defaultOut);%0A            %7D%0A        %7D%0A    %7D
 %0A%7D%0A

Add if else test