For tests, usually matrices are small enough that you can just output them with print
and paste them into the test.
By default, print
doesn’t show all of the digits for floating-point values, but you can print them all using an IOContext
. For example:
print(IOContext(stdout, :compact=>false), rand(3,3))
[0.9063855083253369 0.9628981343254646 0.5753885850862417; 0.46498852170762306 0.5947921287653546 0.3407140607787198; 0.6484533038505804 0.22145148469946463 0.6114550810627906]