more copy optimizations, and additions to unit tests

More optimizations, by @wickedfoo

- Now if the dimensions can be folded for the copy, they are, which makes the indexing math cheaper.
- More robust tests, now compares results against float, and makes sure no copy kernel is triggered except the one for the test.