[Cs5500] Possible whitespace issues using the DemF print() function

Patrick Lannigan lannigan at ccs.neu.edu
Thu Apr 21 14:19:37 EDT 2011


I agree that both tests are important.

The first tests that the system serializes to the format it was
de-serialized from. The serialization code should always produce the same
output for the same object. So this could reveal that the the input
definition is not restrictive enough and allows A and B to both de-serialize
to O. I would expect that if A != B, then parse(A) != parse(B).

The second test ensures that the system preoduces an equivalent object when
parsing the serialized version it created.

As for what to do about the current situation, I think that this is
something that will likely not be solved by Monday. This is much more about
dealing with the idiosyncrasies of demeterf than it is getting the system
running. It is more important that we can correctly run tournaments and
games, write history and log files, and represent the state of the system in
the UI. If the only case where parse(A) == parse(B) are when A and B are
logically equivalent, but have different white spacing, I think it makes
sense to let this be one of the things that would be solved in the next
round of development.

Patrick

On Thu, Apr 21, 2011 at 1:29 PM, Reto Kleeb <kleeb.r at husky.neu.edu> wrote:

> 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)
>
>
>
> _______________________________________________
> Cs5500 mailing list
> Cs5500 at lists.ccs.neu.edu
> https://lists.ccs.neu.edu/bin/listinfo/cs5500
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the Cs5500 mailing list