Small additions to casting test cases and handling.

An additional check should be adding when casting from a Array<T> to a
T[], because the number of dimensions may not be consistent.