mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-28 15:02:46 +08:00
29
src/test/java/com/thealgorithms/others/CRCAlgorithmTest.java
Normal file
29
src/test/java/com/thealgorithms/others/CRCAlgorithmTest.java
Normal 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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user