-
Notifications
You must be signed in to change notification settings - Fork 905
/
Copy pathCombinatoricsTest.cs
103 lines (97 loc) · 3.58 KB
/
CombinatoricsTest.cs
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
using MathNet.Numerics.Combinations;
using NUnit.Framework;
using System;
namespace NUnitTests
{
/// <summary>
/// Permutation tests.
/// </summary>
[TestFixture()]
public class CombinatoricsTest
{
/// <summary>
/// Can create permutation from int array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { -1 })]
[TestCase(new[] { 0 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 5 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 4 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 0 })]
[TestCase(new[] { 0, 4, 3, 2, 1, 5 })]
[TestCase(new[] { 0, 3, 2, 1, 4, 5 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 7 })]
public void CanCreateIntegerPermutation(int[] idx)
{
GC.KeepAlive(new Permutations<int>(idx));
}
/// <summary>
/// Can create permutation from char array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { 'A' })]
[TestCase(new[] { 'A', 'A', 'B', 'C', 'D', 'E' })]
[TestCase(new[] { 'A', 'B', 'C', 'D', 'E', 'F' })]
[TestCase(new[] { 'D', 'E', 'F', 'A', 'B', 'C' })]
public void CanCreateCharPermutation(char[] idx)
{
GC.KeepAlive(new Permutations<char>(idx));
}
/// <summary>
/// Can create permutation from int array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { -1 })]
[TestCase(new[] { 0 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 5 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 4 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 0 })]
[TestCase(new[] { 0, 4, 3, 2, 1, 5 })]
[TestCase(new[] { 0, 3, 2, 1, 4, 5 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 7 })]
public void CanCreateIntegerCombination(int[] idx)
{
GC.KeepAlive(new Combinations<int>(idx, 3));
}
/// <summary>
/// Can create permutation from char array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { 'A' })]
[TestCase(new[] { 'A', 'A', 'B', 'C', 'D', 'E' })]
[TestCase(new[] { 'A', 'B', 'C', 'D', 'E', 'F' })]
[TestCase(new[] { 'D', 'E', 'F', 'A', 'B', 'C' })]
public void CanCreateCharCombination(char[] idx)
{
GC.KeepAlive(new Combinations<char>(idx, 3));
}
/// <summary>
/// Can create permutation from int array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { -1 })]
[TestCase(new[] { 0 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 5 })]
[TestCase(new[] { 0, 1, 2, 3, 4, 4 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 0 })]
[TestCase(new[] { 0, 4, 3, 2, 1, 5 })]
[TestCase(new[] { 0, 3, 2, 1, 4, 5 })]
[TestCase(new[] { 5, 4, 3, 2, 1, 7 })]
public void CanCreateIntegerVariation(int[] idx)
{
GC.KeepAlive(new Variations<int>(idx, 3));
}
/// <summary>
/// Can create permutation from char array.
/// </summary>
/// <param name="idx">Permutations index set.</param>
[TestCase(new[] { 'A' })]
[TestCase(new[] { 'A', 'A', 'B', 'C', 'D', 'E' })]
[TestCase(new[] { 'A', 'B', 'C', 'D', 'E', 'F' })]
[TestCase(new[] { 'D', 'E', 'F', 'A', 'B', 'C' })]
public void CanCreateCharVariation(char[] idx)
{
GC.KeepAlive(new Variations<char>(idx, 3));
}
}
}