Increase test coverage (fixes #3895 #3896) (#3897)

This commit is contained in:
a-kbd
2023-03-05 20:03:08 +01:00
committed by GitHub
parent 87f9ebcb29
commit dd949e9b5d
5 changed files with 166 additions and 8 deletions

View File

@ -0,0 +1,29 @@
package com.thealgorithms.others;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CRCAlgorithmTest {
@Test
void test1(){
CRCAlgorithm c = new CRCAlgorithm("10010101010100101010010000001010010101010", 10, 0.0);
//A bit-error rate of 0.0 should not provide any wrong messages
c.changeMess();
c.divideMessageWithP(false);
assertEquals(c.getWrongMess(), 0);
}
@Test
void test2(){
CRCAlgorithm c = new CRCAlgorithm("10010101010100101010010000001010010101010", 10, 1.0);
//A bit error rate of 1.0 should not provide any correct messages
c.changeMess();
c.divideMessageWithP(false);
assertEquals(c.getCorrectMess(), 0);
}
}