improved test to check for contents of array (#dup method only gives a shallow duplication)