Add automatic linter (#4214)

This commit is contained in:
acbin
2023-06-09 20:05:14 +08:00
committed by GitHub
parent 00282efd8b
commit 415a04ea7f
188 changed files with 661 additions and 1133 deletions

View File

@@ -46,8 +46,7 @@ public class HammingDistanceTest {
@Test
public void checkForLongDataBits() {
String senderBits = "10010101101010000100110100",
receiverBits = "00110100001011001100110101";
String senderBits = "10010101101010000100110100", receiverBits = "00110100001011001100110101";
int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits);
Assertions.assertThat(answer).isEqualTo(7);
}
@@ -56,16 +55,14 @@ public class HammingDistanceTest {
public void mismatchDataBits() {
String senderBits = "100010", receiverBits = "00011";
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class,
() -> { int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits); });
Exception ex = org.junit.jupiter.api.Assertions.assertThrows(IllegalArgumentException.class, () -> { int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits); });
Assertions.assertThat(ex.getMessage()).contains("bits should be same");
}
@Test
public void checkForLongDataBitsSame() {
String senderBits = "10010101101010000100110100",
receiverBits = "10010101101010000100110100";
String senderBits = "10010101101010000100110100", receiverBits = "10010101101010000100110100";
int answer = hd.getHammingDistanceBetweenBits(senderBits, receiverBits);
Assertions.assertThat(answer).isEqualTo(0);
}