/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/bitmanipulation/NextHigherSameBitCountTest.java
22 строки
620 B
Hardik Pawar
Add `NextHigherSameBitCount` algorithm (#5865)
26 окт 2024, 17:31
Не верифицирован
26 окт 2024, 17:31
94daff0
Код
Авторство
О чём код?
package com.thealgorithms.bitmanipulation; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; class NextHigherSameBitCountTest { @ParameterizedTest @CsvSource({ "5, 6", // 101 -> 110 "7, 11", // 0111 -> 1011 "3, 5", // 011 -> 101 "12, 17", // 001100 -> 010001 "15, 23" // 01111 -> 10111 }) void testNextHigherSameBitCount(int input, int expected) { assertEquals(expected, NextHigherSameBitCount.nextHigherSameBitCount(input)); } }