<commit_before>package graph;

import br.pucrs.ap3.graph.Graph;
import br.pucrs.ap3.heap.Heap;
import org.junit.Test;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

/**
 * Class GraphTest is the first assignment...
 */
public class GraphTest {


    @Test
    public void testSingletonColor() {
        int expected[] = {0, 2};
        Graph g = new Graph(1);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSingletonD() {
        float expected[] = {Float.POSITIVE_INFINITY, 0};
        Graph g = new Graph(1);
        g.bfs(1);
        float actual[] = g.getD();
        assertArrayEquals(expected, actual, 0.001f);
    }

    @Test
    public void testSingletonP() {
        int expected[] = {0, 0};
        Graph g = new Graph(1);
        g.bfs(1);
        int actual[] = g.getP();
        assertArrayEquals(expected, actual);
    }


    @Test
    public void testSimpleColor() {
        int expected[] = {0, 2, 2, 2};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        g.addConnection(2, 3);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSimpleNotConnectedColor() {
        int expected[] = {0, 2, 2, 0};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        //g.addConnection(2, 3);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSimpleD() {
        float expected[] = {Float.POSITIVE_INFINITY, 0, 1, 2};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        g.addConnection(2, 3);
        g.bfs(1);
        float actual[] = g.getD();
        assertArrayEquals(expected, actual, 0.001f);
    }

}<commit_msg>Teste do BFS. #4<commit_after>package graph;

import br.pucrs.ap3.graph.Graph;
import br.pucrs.ap3.heap.Heap;
import org.junit.Test;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;

/**
 * Class GraphTest is the first assignment...
 */
public class GraphTest {


    @Test
    public void testSingletonColor() {
        int expected[] = {0, 2};
        Graph g = new Graph(1);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSingletonD() {
        float expected[] = {Float.POSITIVE_INFINITY, 0};
        Graph g = new Graph(1);
        g.bfs(1);
        float actual[] = g.getD();
        assertArrayEquals(expected, actual, 0.001f);
    }

    @Test
    public void testSingletonP() {
        int expected[] = {0, 0};
        Graph g = new Graph(1);
        g.bfs(1);
        int actual[] = g.getP();
        assertArrayEquals(expected, actual);
    }


    @Test
    public void testSimpleColor() {
        int expected[] = {0, 2, 2, 2};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        g.addConnection(2, 3);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSimpleNotConnectedColor() {
        int expected[] = {0, 2, 2, 0};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        //g.addConnection(2, 3);
        g.bfs(1);
        int actual[] = g.getColor();
        assertArrayEquals(expected, actual);
    }

    @Test
    public void testSimpleD() {
        float expected[] = {Float.POSITIVE_INFINITY, 0, 1, 2};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        g.addConnection(2, 3);
        g.bfs(1);
        float actual[] = g.getD();
        assertArrayEquals(expected, actual, 0.001f);
    }
    @Test
    public void testSimpleP() {
        int expected[] = {0, 0, 1, 2};
        Graph g = new Graph(3);
        g.addConnection(1, 2);
        g.addConnection(2, 3);
        g.bfs(1);
        int actual[] = g.getP();
        assertArrayEquals(expected, actual);
    }
}
{'fraction_non_alphanumeric': 0.14222331772245503, 'fraction_numerical': 0.027360118314025142, 'mean_word_length': 2.0906321401370906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4539207', 'n_tokens_mistral': 1393, 'n_tokens_neox': 1324, 'n_words': 329}