/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/strings/CountCharTest.java
24 строки
927 B
B Karthik
fix: change location of others to correct places (#5559)
04 окт 2024, 20:47
Не верифицирован
04 окт 2024, 20:47
042d458
Код
Авторство
О чём код?
package com.thealgorithms.strings; import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; class CountCharTest { @ParameterizedTest(name = "\"{0}\" should have {1} non-whitespace characters") @CsvSource({"'', 0", "' ', 0", "'a', 1", "'abc', 3", "'a b c', 3", "' a b c ', 3", "'\tabc\n', 3", "' a b\tc ', 3", "' 12345 ', 5", "'Hello, World!', 12"}) @DisplayName("Test countCharacters with various inputs") void testCountCharacters(String input, int expected) { assertEquals(expected, CountChar.countCharacters(input)); } @Test @DisplayName("Test countCharacters with null input") void testCountCharactersNullInput() { assertEquals(0, CountChar.countCharacters(null)); } }