mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 23:15:17 +08:00
style: enable TypeName
(#5214)
* style: enable `TypeName` in checkstyle * style: enable `TypeName` in checkstyle * Update directory * style: use proper formatting --------- Co-authored-by: StarDxxx <StarDxxx@users.noreply.github.com> Co-authored-by: Piotr Idzik <65706193+vil02@users.noreply.github.com>
This commit is contained in:
@ -4,7 +4,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class climbStairsTest {
|
||||
public class ClimbStairsTest {
|
||||
|
||||
@Test
|
||||
void climbStairsTestForTwo() {
|
17
src/test/java/com/thealgorithms/others/CountSetBitsTest.java
Normal file
17
src/test/java/com/thealgorithms/others/CountSetBitsTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class CountSetBitsTest {
|
||||
|
||||
@Test
|
||||
void testSetBits() {
|
||||
CountSetBits csb = new CountSetBits();
|
||||
assertEquals(1L, csb.countSetBits(16));
|
||||
assertEquals(4, csb.countSetBits(15));
|
||||
assertEquals(5, csb.countSetBits(10000));
|
||||
assertEquals(5, csb.countSetBits(31));
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package com.thealgorithms.others;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class countSetBitsTest {
|
||||
|
||||
@Test
|
||||
void testSetBits() {
|
||||
countSetBits csb = new countSetBits();
|
||||
assertEquals(1L, csb.countsetBits(16));
|
||||
assertEquals(4, csb.countsetBits(15));
|
||||
assertEquals(5, csb.countsetBits(10000));
|
||||
assertEquals(5, csb.countsetBits(31));
|
||||
}
|
||||
}
|
@ -4,13 +4,13 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class sortOrderAgnosticBinarySearchTest {
|
||||
public class SortOrderAgnosticBinarySearchTest {
|
||||
|
||||
@Test
|
||||
public void testAscending() {
|
||||
int[] arr = {1, 2, 3, 4, 5}; // for ascending order.
|
||||
int target = 2;
|
||||
int ans = sortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int ans = SortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int excepted = 1;
|
||||
assertEquals(excepted, ans);
|
||||
}
|
||||
@ -19,7 +19,7 @@ public class sortOrderAgnosticBinarySearchTest {
|
||||
public void testDescending() {
|
||||
int[] arr = {5, 4, 3, 2, 1}; // for descending order.
|
||||
int target = 2;
|
||||
int ans = sortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int ans = SortOrderAgnosticBinarySearch.find(arr, target);
|
||||
int excepted = 3;
|
||||
assertEquals(excepted, ans);
|
||||
}
|
@ -3,13 +3,13 @@ package com.thealgorithms.strings;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class longestNonRepeativeSubstringTest {
|
||||
public class LongestNonRepeativeSubstringTest {
|
||||
|
||||
@Test
|
||||
public void palindrome() {
|
||||
String input1 = "HelloWorld";
|
||||
String input2 = "javaIsAProgrammingLanguage";
|
||||
Assertions.assertEquals(longestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
|
||||
Assertions.assertEquals(longestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
|
||||
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input1), 5);
|
||||
Assertions.assertEquals(LongestNonRepeativeSubstring.lengthOfLongestSubstring(input2), 9);
|
||||
}
|
||||
}
|
@ -3,13 +3,13 @@ package com.thealgorithms.strings.zigZagPattern;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class zigZagPatternTest {
|
||||
public class ZigZagPatternTest {
|
||||
|
||||
@Test
|
||||
public void palindrome() {
|
||||
String input1 = "HelloWorldFromJava";
|
||||
String input2 = "javaIsAProgrammingLanguage";
|
||||
Assertions.assertEquals(zigZagPattern.encode(input1, 4), "HooeWrrmalolFJvlda");
|
||||
Assertions.assertEquals(zigZagPattern.encode(input2, 4), "jAaLgasPrmgaaevIrgmnnuaoig");
|
||||
Assertions.assertEquals(ZigZagPattern.encode(input1, 4), "HooeWrrmalolFJvlda");
|
||||
Assertions.assertEquals(ZigZagPattern.encode(input2, 4), "jAaLgasPrmgaaevIrgmnnuaoig");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user