PDL recently (as of 2.094) incorporated Test::PDL. I wish that had happened years ago, because being able to use
is_pdl is just great compared to the contortions needed otherwise: it does approximate matching, with configurable absolute
or relative tolerances, it will check types and dimensions, report in some detail any differences, which nearly always means not needing to capture any results in a variable for failure-reporting.
And using PDL for this sort of data-handling would be very obvious, and there's even a recently-added vector-cosine function for exactly Bod's use-case. What's not to like?