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

Testing Homework #55

Open
wants to merge 3 commits into
base: master
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
*/
public class BubbleSort extends SortingAlgorithm {


/**
* Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that
* repeatedly steps through the list to be sorted, compares each pair of adjacent items and swaps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,30 @@ public class MultiplicationWithoutMultiplyTest {
@Test public void shouldTakeIntoAccountNegativeNumbers() {
assertEquals(-14, multiply.calculate(-2, 7));
}

/**
* This tests for Testing HomeWord - Dinh The Hiep - 17020731
*/

//Testing with both negative n1,n2 (n1 < 0, n2 < 0)
@Test
public void test1() {
assertEquals(5600, multiply.calculate(-70,-80));
}
//Testing with n1 > 0, n2 >0
@Test
public void test2() {
assertEquals(484, multiply.calculate(44, 11));
}
//Testing with n1 > 0, n2 < 0
@Test
public void test3() {
assertEquals(-1500, multiply.calculate(500, -3));
}
//Testing with n2 > 0, n1 < 0
@Test
public void test4() {
assertEquals(-4500, multiply.calculate(3, -1500));
}

}
45 changes: 45 additions & 0 deletions src/test/java/com/github/pedrovgs/problem74/BubbleSortTest2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.github.pedrovgs.problem74;

import org.junit.Test;

import static org.junit.Assert.*;

public class BubbleSortTest2 {
@Test
public void Intsort(){
int[] input = { 1, 2, 4, 3 };
int[] expectedArray = { 1, 2, 3, 4 };
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(input);
assertArrayEquals(expectedArray,input);
}

@Test
public void Doublesort(){
int[] input = {-100,63,-62,6};
int[] expectedArray = { 1, 2, 3, 4 };
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(input);
assertArrayEquals(expectedArray,input);
}

@Test
public void Randomsort(){
int[] input = { 5,-541,56,45,26};
int[] expectedArray = { 1, 2, 3, 4 };
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(input);
assertArrayEquals(expectedArray,input);
}

@Test
public void RanDomsort(){
int[] input = { 10,559,-65,622,-65,-6};
int[] expectedArray = { 1, 2, 3, 4 };
BubbleSort bubbleSort = new BubbleSort();
bubbleSort.sort(input);
assertArrayEquals(expectedArray,input);
}


}