Boost logo

Boost Users :

Subject: [Boost-users] Change format output for strings
From: Mads Bondo Dydensborg (mbd_at_[hidden])
Date: 2008-10-01 07:34:24

Hi there.

I have some unittests that compare strings, that look something like this,
when they are run, and fails: error in "itemorder":
check "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>todo" ==
output_24575997 failed [<?xml version="1.0" encoding="ISO-8859-1"?>todo !=
<?xml version="1.0" encoding="ISO-8859-1"?><!-- Alle
niveauer --><ill5:ILL-APDU
protocol-version-num="2" place-on-hold="1" ><transaction-id
og lok=870970</system-no></item-id></ill5:ILL-Request-1></ill5:ILL-APDU>]

Now, this is almost impossible to read.

Is there a way to massage the framework into giving output similar to how
nunit does it, something like: error in "itemorder":
check "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>todo" ==
output_24575997 failed
output differs at position 42
expected ...ISO-8859-1"?><!-- Alle niveauer ...
got ...ISO-8859-1"?>todo<eof>

(You need a fixed font, I reckon).

In the example I know it is quite simple, but I wanted to spare you for some
functions we have, where we have to run wdiff on them to see the difference.
(And, not to worry, we are not generating XML by hand, but this was the
example I had ready). It would be cool to have this in the testing
framework - writing code to do this on two different strings are no problem,
but I have absolutely no clue on how to the test framework to do it. I got as
long as

void check_impl( predicate_result const& pr, wrap_stringstream& check_descr,
                 const_string file_name, std::size_t line_num,
                 tool_level tl, check_type ct,
                 std::size_t num_args, ... );

before I gave up - perhaps someone else knows how to get further?

Thanks in advance


Med venlig hilsen/Regards
Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at