package com.thealgorithms.others;

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

import org.junit.jupiter.api.Test;

public class ConwayTest {
    @Test
    public void testGenerateWith1() {
        assertEquals("31131211131221", Conway.generateList("1", 8).get(7));
    }

    @Test
    public void testGenerateWith123456() {
        assertEquals(
            "13211321322113311213212312311211131122211213211331121321122112133221123113112221131112212211131221121321131211132221123113112221131112311332211211131221131211132211121312211231131112311211232221143113112221131112311332111213122112311311123112112322211531131122211311123113321112131221123113111231121123222116",
            Conway.generateList("123456", 20).get(11));
    }

    @Test
    public void testGenerateWith1A1Z3E1R1T3G1F1D2E1S1C() {
        assertEquals(
            "[encoded data, 7892 characters]",
            Conway.generateList("1A1Z3E1R1T3G1F1D2E1S1C", 20).get(19));
    }

    @Test
    public void testGenerateNextElementWith1() {
        assertEquals("11", Conway.generateNextElement("1"));
    }

    @Test
    public void testGenerateNextElementWith123456() {
        assertEquals("111213141516", Conway.generateNextElement("123456"));
    }

    @Test
    public void testGenerateNextElementWith1A1Z3E1R1T3G1F1D2E1S1C() {
        assertEquals("111A111Z131E111R111T131G111F111D121E111S111C", Conway.generateNextElement("1A1Z3E1R1T3G1F1D2E1S1C"));
    }
}
