forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCRCAlgorithmTest.java
More file actions
29 lines (21 loc) · 794 Bytes
/
Copy pathCRCAlgorithmTest.java
File metadata and controls
29 lines (21 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package com.thealgorithms.others;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
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);
}
}