[Cs5500] Possible whitespace issues using the DemF print() function
Reto Kleeb
kleeb.r at husky.neu.edu
Thu Apr 21 13:29:56 EDT 2011
Hey,
about a week ago we discussed that a system that serializes objects to
strings (and back), (eg. XML or like in our case in DemF defined syntax)
should have the following property:
String serialized = "MY-OBJECT AS A STRING"
Object myObj = Object.parse(serialized)
assertEquals(serialized, myObj.serializeToString())
and
assertEquals(myObj, Object.parse(myObj.serializeToString()))
It could be argued that these two tests do the same, but I argue that
only if we include the first test, we verify our system against a
"hand-written, visible" string.
In our project such a test looks like this:
String inpt = "hsr.HSRInstanceSet {{ HSR (9,2) }}
scg.protocol.ForAllExists {{ }} 0.44444 0.44444";
Claim claim = Claim.parse(inpt);
Assert.assertEquals(inpt, claim.print());
The problem now is, that this test fails, DemeterF adds an extra white
space character in the printed string
(http://img685.imageshack.us/i/demfwhitespace.png/). This is obviously
related to the *s in the grammar.
Now our question basically is, is this something that we need to accept
in this situation? Or can we get DemeterF to omit these extra characters
without changing the grammar?
Best
Reto (PRX)
More information about the Cs5500
mailing list