Skip to content

Test #18

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

Closed
wants to merge 7 commits into from
Closed

Test #18

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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ buildNumber.properties
.mvn/timing.properties
!/.mvn/wrapper/maven-wrapper.jar
*_Practice.java
/bin/
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class InsortionSort1Test {

QuickSort2 quickSort2 = new QuickSort2();

@Test
public void tesInsertIntoSorted1() {
int[] inputArr = new int[] {9, 2, 5, 4, 3, 6, 1};
int[] inputResult = new int[] {1, 2, 3, 4, 5, 6, 9};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {-101, -100, -99, -95, -97, -96, -98};
int[] inputResult = new int[] {-101,-100, -99, -98, -97, -96, -95};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class QuickSort1Test {

QuickSort2 quickSort2 = new QuickSort2();

@Test
public void tesInsertIntoSorted1() {
int[] inputArr = new int[] {10, 2, 15, 3, 7, 6, 20};
int[] inputResult = new int[] {2, 3, 6, 7, 10, 15, 20};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {-101, -100, -99, -95, -97, -96, -98};
int[] inputResult = new int[] {-101,-100, -99, -98, -97, -96, -95};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

@RunWith(JUnit4.class)
public class QuickSort2Test {

QuickSort2 quickSort2 = new QuickSort2();

@Test
public void tesInsertIntoSorted1() {
int[] inputArr = new int[] {9, 2, 5, 4, 3, 6, 1};
int[] inputResult = new int[] {1, 2, 3, 4, 5, 6, 9};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {-101, -100, -99, -95, -97, -96, -98};
int[] inputResult = new int[] {-101,-100, -99, -98, -97, -96, -95};
QuickSort2.quickSort(inputArr, 0, 6);
assertArrayEquals(inputResult, inputArr);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


@RunWith(JUnit4.class)
public class SampleTest {
InsertionSort1 insertionSort1 = new InsertionSort1();
@Test
public void tesInsertIntoSorted() {
int[] inputArr = new int[] {1,2,4};
int[] inputResult = new int[] {1,2,4};
InsertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {1,6,4};
int[] inputResult = new int[] {1, 4, 6};
InsertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;


@RunWith(JUnit4.class)
public class SampleTest2 {
InsertionSort1 insertionSort1 = new InsertionSort1();
@Test
public void tesInsertIntoSorted() {
int[] inputArr = new int[] {1,2,4};
int[] inputResult = new int[] {1,2,4};
insertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {1,6,4};
int[] inputResult = new int[] {1, 4, 6};
insertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.hackerrank.algorithms.arraysandsorting;

import static org.junit.Assert.assertArrayEquals;

import org.junit.Test;

public class SampleTest3 {
InsertionSort1 insertionSort1 = new InsertionSort1();
@Test
public void tesInsertIntoSorted() {
int[] inputArr = new int[] {1,2,4};
int[] inputResult = new int[] {1,2,4};
InsertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}

@Test
public void tesInsertIntoSorted2() {
int[] inputArr = new int[] {1,6,4};
int[] inputResult = new int[] {1, 4, 6};
InsertionSort1.insertIntoSorted(inputArr);
assertArrayEquals(inputResult, inputArr);
}
}