Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Teste JUnit no BubbleSort #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions src/test/java/BubbleSortTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

import org.junit.jupiter.api.Test;
import edu.ifrs.vvs.BubbleSort;

public class BubbleSortTest {

private BubbleSort bubbleSort = new BubbleSort();

//notação test pra indicar o método
//zero elementos
@Test
public void nadaComNenhum() {
int[] valores = {};
bubbleSort.sort(valores);
}

//um elemento
@Test
public void nadaComUm(){
int[] valores = {2};

bubbleSort.sort(valores);
assertArrayEquals(new int[] {2}, valores);

}

@Test
public void sortValores(){
int[] valores = {0, 200, -3, 14, 100};
int[] ordemEsperada = {-3, 0, 14, 100, 200};

bubbleSort.sort(valores);
assertArrayEquals(ordemEsperada, valores);
}

}

//ao concluir, ir para o erlenmeyer (extensão de teste)
35 changes: 0 additions & 35 deletions src/test/java/edu/ifrs/vvs/AppTest.java

This file was deleted.