/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/bitmanipulation/ParityCheckTest.java
15 строк
525 B
Hardik Pawar
Add `ParityCheck` algorithm (#5704)
12 окт 2024, 10:28
Не верифицирован
12 окт 2024, 10:28
8722598
Код
Авторство
О чём код?
package com.thealgorithms.bitmanipulation; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; import org.junit.jupiter.api.Test; public class ParityCheckTest { @Test public void testIsOddParity() { assertTrue(ParityCheck.checkParity(5)); // 101 has 2 ones (even parity) assertFalse(ParityCheck.checkParity(7)); // 111 has 3 ones (odd parity) assertFalse(ParityCheck.checkParity(8)); // 1000 has 1 one (odd parity) } }