/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/matrix/TestPrintMatrixInSpiralOrder.java
26 строк
1011 B
varada610
Refactor files to be in correctly nested packages (#6120)
11 янв 2025, 10:17
Не верифицирован
11 янв 2025, 10:17
1e6ed97
Код
Авторство
О чём код?
package com.thealgorithms.matrix; import static org.junit.jupiter.api.Assertions.assertIterableEquals; import java.util.List; import org.junit.jupiter.api.Test; public class TestPrintMatrixInSpiralOrder { @Test public void testOne() { int[][] matrix = {{3, 4, 5, 6, 7}, {8, 9, 10, 11, 12}, {14, 15, 16, 17, 18}, {23, 24, 25, 26, 27}, {30, 31, 32, 33, 34}}; var printClass = new PrintAMatrixInSpiralOrder(); List<Integer> res = printClass.print(matrix, matrix.length, matrix[0].length); List<Integer> list = List.of(3, 4, 5, 6, 7, 12, 18, 27, 34, 33, 32, 31, 30, 23, 14, 8, 9, 10, 11, 17, 26, 25, 24, 15, 16); assertIterableEquals(res, list); } @Test public void testTwo() { int[][] matrix = {{2, 2}}; var printClass = new PrintAMatrixInSpiralOrder(); List<Integer> res = printClass.print(matrix, matrix.length, matrix[0].length); List<Integer> list = List.of(2, 2); assertIterableEquals(res, list); } }