public void TruthTableTest2()
{
// Suppose we would like to generate a truth table (i.e. all possible
// combinations of a set of discrete symbols) for variables that contain
// different numbers symbols. Let's say, for example, that the first
// variable may contain symbols 0 and 1, the second could contain either
// 0, 1, or 2, and the last one again could contain only 0 and 1. Thus
// we can generate the truth table in the following way:
int[] symbols = { 2, 3, 2 };
int[][] actual = Combinatorics.TruthTable(symbols);
int[][] expected =
{
new int[] { 0, 0, 0 },
new int[] { 0, 0, 1 },
new int[] { 0, 1, 0 },
new int[] { 0, 1, 1 },
new int[] { 0, 2, 0 },
new int[] { 0, 2, 1 },
new int[] { 1, 0, 0 },
new int[] { 1, 0, 1 },
new int[] { 1, 1, 0 },
new int[] { 1, 1, 1 },
new int[] { 1, 2, 0 },
new int[] { 1, 2, 1 },
};
Assert.IsTrue(expected.IsEqual(actual));
}