<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.io.*;
import java.util.Locale;
import java.util.Scanner;
import junit.framework.TestCase;

public class figuryTest extends TestCase {

    private ByteArrayOutputStream outContent;;

    private void setUpStreams(String inp) {
        outContent = new ByteArrayOutputStream();
        System.setOut(new PrintStream(outContent));
        System.setIn(new ByteArrayInputStream(inp.getBytes()));
    }

    private void cleanUpStreams() {
        System.setOut(null);
        System.setIn(null);
    }

    private String runProgram(String inp) {
        try {
            setUpStreams(inp);
            Main.main(new String[0]);
            return outContent.toString();
        } finally {
            cleanUpStreams();
        }
    }
    
    private String T(double x1,double y1,double x2, double y2, double x3, double y3) {
        return String.format(Locale.US,"T %1$.6f %2$.6f %3$.6f %4$.6f %5$.6f %6$.6f",x1,y1,x2,y2,x3,y3)+"\n";
    }

    private String K(double x1,double y1,double r) {
        return String.format(Locale.US,"K %1$.6f %2$.6f %3$.6f",x1,y1,r)+"\n";
    }

    private String P(double x1,double y1,double x2, double y2) {
        return String.format(Locale.US,"P %1$.6f %2$.6f %3$.6f %4$.6f",x1,y1,x2,y2)+"\n";
    }
    
    private void prostyTest(int n,String opis,String wynik) {
        String inp=""+n+"\n"+opis;
        String should_be="Pole "+wynik+"\n"+opis;
        assertEquals(should_be, runProgram(inp));
    }

    public void testTrojkat() {
      prostyTest(1,T(0,0,1,1,2,0),"1.000000");
      prostyTest(1,T(2,0,1,1,0,0),"1.000000");
    }

    public void testProstokat() {
      prostyTest(1,P(0,0,2,3),"6.000000");
      prostyTest(1,P(2,3,0,0),"6.000000");
    }

    public void testKolo() {
      prostyTest(1,K(0,0,1),"3.141593");
    }

    public void testWiele() {
      prostyTest(3,T(0,0,1,1,2,0)+P(0,0,2,3)+K(0,0,1),"10.141593");
    }


}
</pre></body></html>