Validation test class for
Domino
that uses a
Random
RNG for simulation purposes.
This test is not complete, and requires the tester to check the console screen for the correct behaviour.
For a more complete (automated) test suite see
JUnit_Domino
The RNG can be seeded at the command line, or a default value of 0 can be used.
We use the
DateHeader
class to document the date/time of the test execution
Expected Output (using default RNG seed = 0):
The seed used for the random number generator in the test is 0.
You can override this value by passing an integer value as a main argument parameter, if you so wish.
Execution Date/Time 2014/04/23 16:34:16
Constructing all possible dominoes
0 : 0, hashCode = 9
0 : 1, hashCode = 12
0 : 2, hashCode = 15
0 : 3, hashCode = 18
0 : 4, hashCode = 21
0 : 5, hashCode = 24
0 : 6, hashCode = 27
1 : 1, hashCode = 16
1 : 2, hashCode = 20
1 : 3, hashCode = 24
1 : 4, hashCode = 28
1 : 5, hashCode = 32
1 : 6, hashCode = 36
2 : 2, hashCode = 25
2 : 3, hashCode = 30
2 : 4, hashCode = 35
2 : 5, hashCode = 40
2 : 6, hashCode = 45
3 : 3, hashCode = 36
3 : 4, hashCode = 42
3 : 5, hashCode = 48
3 : 6, hashCode = 54
4 : 4, hashCode = 49
4 : 5, hashCode = 56
4 : 6, hashCode = 63
5 : 5, hashCode = 64
5 : 6, hashCode = 72
6 : 6, hashCode = 81
Randomly creating a domino
5 : 2
left = 5
right = 2
hash = 40
Switching sides
2 : 5
left = 2
right = 5
hash = 40
Making a copy
2 : 5
Checking exceptions for constructor
Properly caught exceptionjava.lang.IllegalArgumentException: left value of -1 is smaller than MIN = 0
Properly caught exceptionjava.lang.IllegalArgumentException: right value of -1 is smaller than MIN = 0
Properly caught exceptionjava.lang.IllegalArgumentException: left value of 7 is bigger than MAX = 6
Properly caught exceptionjava.lang.IllegalArgumentException: right value of 7 is bigger than MAX = 6
Looping until 2 randomly created dominoes are the same:
4 : 2 --- 4 : 0
2 : 1 --- 6 : 2
1 : 2 --- 0 : 2
4 : 0 --- 3 : 0
6 : 0 --- 1 : 3
3 : 4 --- 2 : 2
6 : 5 --- 2 : 6
0 : 3 --- 2 : 0
4 : 3 --- 3 : 0
3 : 1 --- 0 : 5
3 : 0 --- 6 : 1
5 : 0 --- 6 : 0
0 : 6 --- 6 : 5
4 : 3 --- 3 : 4
Checking that the random construction appears 'reasonably' random so that:
the frequency of each value chosen at random should be approx. equal to 100
left [0] = 101
right [0] = 95
left [1] = 83
right [1] = 93
left [2] = 105
right [2] = 113
left [3] = 91
right [3] = 93
left [4] = 93
right [4] = 114
left [5] = 113
right [5] = 89
left [6] = 114
right [6] = 103