提交 156befeb 编写于 作者: H hunghv-0939

Test Backtracking NQueens

上级 7e2b3e07
package com.gpcoder.junit.util;
import org.junit.Assert;
import org.junit.Test;
public class solveNQueensTest {
public void dfsTest() {
List<List<String>> resultList = new LinkedList<>();
final int[] expected = [2, 4, 6, 8, 3, 1, 7, 5];
final int[] result = new int[8];
dfs(resultList, result, 0, 8);
Assert.assertArrayEquals(expected, result);
}
public void dfsTest2() {
List<List<String>> resultList = new LinkedList<>();
final int[] expected = [2, 4, 1, 3];
final int[] result = new int[4];
dfs(resultList, result, 0, 4);
Assert.assertArrayEquals(expected, result);
}
public void dfsTest3() {
List<List<String>> resultList = new LinkedList<>();
final int[] expected = [];
final int[] result = new int[3];
dfs(resultList, result, 0, 3);
Assert.assertArrayEquals(expected, result);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册