Generalize function stats.mood to 2d (n-d) case, add some tests for the function

The input arrays are flattened before applying statistical test. The results from the generalization correspond to the results from R given the same inputs (see corresponding tests for the function stats.mood).