diff --git a/README.md b/README.md index 987b7ba..a488286 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Chesslib dependency can be added via the jitpack repository. com.github.bhlangonijr chesslib - 1.3.3 + 1.3.4 ``` @@ -71,7 +71,7 @@ repositories { ```groovy dependencies { ... - compile 'com.github.bhlangonijr:chesslib:1.3.3' + compile 'com.github.bhlangonijr:chesslib:1.3.4' ... } ``` diff --git a/pom.xml b/pom.xml index ba381a3..c5ae0a5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.bhlangonijr.chesslib chesslib - 1.3.3 + 1.3.4 UTF-8 diff --git a/src/main/java/com/github/bhlangonijr/chesslib/Bitboard.java b/src/main/java/com/github/bhlangonijr/chesslib/Bitboard.java index be5fa45..9a4b0ac 100644 --- a/src/main/java/com/github/bhlangonijr/chesslib/Bitboard.java +++ b/src/main/java/com/github/bhlangonijr/chesslib/Bitboard.java @@ -432,7 +432,7 @@ public static long extractLsb(Long bb) { * @return {@code true} if the bitboard has only one bit set to 1 */ public static boolean hasOnly1Bit(Long bb) { - return bb > 0L && extractLsb(bb) == 0L; + return bb != 0L && extractLsb(bb) == 0L; } /** diff --git a/src/test/java/com/github/bhlangonijr/chesslib/bitboard/BitboardTest.java b/src/test/java/com/github/bhlangonijr/chesslib/bitboard/BitboardTest.java index b861dfe..0426750 100644 --- a/src/test/java/com/github/bhlangonijr/chesslib/bitboard/BitboardTest.java +++ b/src/test/java/com/github/bhlangonijr/chesslib/bitboard/BitboardTest.java @@ -5,6 +5,7 @@ import org.junit.Test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; /** * The type Bitboard test. @@ -56,4 +57,12 @@ public void testBBFunctions() { } + @Test + public void testHasOnlyOneBit() { + + for (int i = 0; i < Square.values().length - 1; i++) { + assertTrue(Bitboard.hasOnly1Bit(Square.squareAt(i).getBitboard())); + } + } + } \ No newline at end of file