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

Implementado testes unitarios para o BubbleSort -tarefa vvs #46

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
89 changes: 80 additions & 9 deletions src/test/java/edu/ifrs/vvs/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,90 @@

package edu.ifrs.vvs;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;

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


/**
* Unit test for simple App.
*/
class AppTest {
/**
* Rigorous Test.
*/


@Test
@DisplayName("test 1 elemento")
@Order(1)
void testAppOneElement() {
BubbleSort buuble = new BubbleSort();
int v[] = {1};
int v2[] = {1};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
@DisplayName("test 2 elementos")
@Order(2)
void testAppTwoElements() {
BubbleSort buuble = new BubbleSort();
int v[] = {1, 2};
int v2[] = {1, 2};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
@DisplayName("test 2 elementos invertidos")
@Order(3)
void testApp2ElementsReverse() {
BubbleSort buuble = new BubbleSort();
int v[] = {2, 1};
int v2[] = {1, 2};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
@DisplayName("test More elementos sortidos")
@Order(4)
void testAppMoreElementsSorted() {
BubbleSort buuble = new BubbleSort();
int v[] = {2, 1, 5, 4, 3, 8, 7, 6};
int v2[] = {1, 2, 3, 4, 5, 6, 7, 8};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
@DisplayName("test elementos sortidos faltando")
@Order(1)
void testAppMissingSomeElementsSorted() {
BubbleSort buuble = new BubbleSort();
int v[] = {2, 1, 5, 3, 7, 6};
int v2[] = {1, 2, 3, 5, 6, 7};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
@DisplayName("test elementos sortidos faltando com zero")
@Order(2)
void testAppElementsSortedwithZero() {
BubbleSort buuble = new BubbleSort();
int v[] = {2, 1, 18015, 5, 3, 0, 6};
int v2[] = {0, 1, 2, 3, 5, 6, 18015};
buuble.sort(v);
assertArrayEquals(v, v2);
}

@Test
void testApp() {
assertEquals(1, 1);
@DisplayName("test elementos sortidos faltando com zero e negativos")
@Order(3)
void testAppElementsSortedwithZeroandNegatives() {
BubbleSort buuble = new BubbleSort();
int v[] = {2, 1, 5, -10, 3, 1589, 0, 6};
int v2[] = {-10, 0, 1, 2, 3, 5, 6, 1589};
buuble.sort(v);
assertArrayEquals(v, v2);
}
}