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

add: adiciona testes para a classe BubbleSort.java #35

Open
wants to merge 1 commit 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
4 changes: 3 additions & 1 deletion src/test/java/edu/ifrs/vvs/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class AppTest {
*/
@Test
void testApp() {
assertEquals(1, 1);
int expected = 1;
int actual = 1;
assertEquals(expected, actual);
}
}
50 changes: 50 additions & 0 deletions src/test/java/edu/ifrs/vvs/BubbleSortTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package edu.ifrs.vvs;

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

import org.junit.jupiter.api.Test;

public class BubbleSortTest {

BubbleSort bubbleSort = new BubbleSort();

@Test
public void mustReturnArrayWithNoRepeatedElementsSortedArray() {
int[] actual = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
int[] expected = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

bubbleSort.sort(actual);

assertArrayEquals(expected, actual);
}

@Test
public void mustReturnArrayWithNoRepeatedElementsUnsortedArray() {
int[] actual = new int[] { 5, 3, 1, 4, 2, 7, 6, 9, 8 };
int[] expected = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };

bubbleSort.sort(actual);

assertArrayEquals(expected, actual);
}

@Test
public void mustReturnArrayWithRepeatedElementsSortedArray() {
int[] actual = new int[] { 1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9 };
int[] expected = new int[] { 1, 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9 };

bubbleSort.sort(actual);

assertArrayEquals(expected, actual);
}

@Test
public void mustReturnArrayWithRepeatedElementsUnsortedArray() {
int[] actual = new int[] { 5, 3, 1, 7, 3, 4, 2, 7, 6, 9, 8, 5 };
int[] expected = new int[] { 1, 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9 };

bubbleSort.sort(actual);

assertArrayEquals(expected, actual);
}
}