test: Check that ANSI and prdef are properly stored with elog_add
Backport of !6039 (merged) and !6040 (merged) into the master.
The code was already working as expected. This PR only adds the similar unittests to check that printing ANSI or using prdef
produce the expected result in the elogbook.