forked from Snailclimb/JavaGuide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_backtracking_nqueen.jav
More file actions
26 lines (26 loc) · 908 Bytes
/
test_backtracking_nqueen.jav
File metadata and controls
26 lines (26 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
}
}