package worms.model;

import org.junit.jupiter.api.*;

import static org.junit.jupiter.api.Assertions.*;
import worms.util.Tuple;

class WormTest {

    /*private Worm worm;

    @BeforeEach
    void setUp() {
        worm = new Worm(Tuple.create(0.0, 0.0), 0, "Test", 1);
    }

    @Test
    void getLocation() {

        assertEquals(Tuple.create(0.0, 0.0), worm.getLocation());
    }

    @Test
    void getOrientation() {
        assertEquals(0, worm.getOrientation());
    }

    @Test
    void getRadius() {
        assertEquals(1, worm.getRadius());
    }

    @Test
    void setRadius() {
    	worm.setRadius(2);
    	assertEquals(2, worm.getRadius());
    }

    @Test
    void getMinimumRadius() {
    	assertEquals(0.25, worm.getMinRadius());
    }

    @Test
    void getMass1() {
    	assertEquals(4448.0, worm.getMass());

    	//Leen: ik heb bij de setMass round rond de formule gezet, anders was test fout.
    	//Moet dit round of ceil zijn? Ik dacht round, maar ben niet zeker
    }

    @Test
    void getActionPoints() {
    	assertEquals(4448.0, worm.getActionPoints());
    }

    @Test
    void getMaxActionPoints() {
    	assertEquals(4448.0, worm.getMaxActionPoints());
    }

    @Test
    void setActionPoints() {
    	worm.setActionPoints(300);
    	assertEquals(300, worm.getActionPoints());
    }

    @Test
    void decreaseActionPoints() {
    	worm.decreaseActionPoints(48);
    	assertEquals(4400, worm.getActionPoints());
    }

    @Test
    void getName() {
    }

    @Test
    void setName() {
    	worm.setName("Jefke Janssens");
    	assertEquals("Jefke Janssens", worm.getName());
    }

    @Test
    void setName2() {
    	worm.setName("Jefke 'anssens");
    	assertEquals("Jefke 'anssens", worm.getName());
    }*/

    private static Worm worm;

    @BeforeAll
    static void setUp() {
        worm = new Worm(Tuple.create(0.0, 0.0), 0, "Test", 1);
    }

    @Test
    void move() {
        assertEquals("Test", worm.getName());
    }

    @Test
    void turn() {
    }

    @RepeatedTest(10)
    void jump(RepetitionInfo repetitionInfo) {
        if (repetitionInfo.getCurrentRepetition() > 1){
            assertThrows(IllegalStateException.class, () -> worm.jump());
        }
        else {
            worm.jump();
        }

    }
}