w3c / N3

W3C's Notation 3 (N3) Community Group
47 stars 18 forks source link

Some evil test cases for paths #156

Open jeswr opened 1 year ago

jeswr commented 1 year ago

In N3.js I'm planning to add these unit tests to catch common errors around lists and paths. In particular it would be good to see cases like (()!:p)^:p2!:p3 :p4 :o in the evaluation test suite if not already present.

william-vw commented 1 year ago

@jeswr Please add a PR with the test cases you are planning here.

TallTed commented 1 year ago

I would like to see both maximally human-friendly (i.e., including all optional whitespace and punctuation) and maximally machine-friendly (i.e., removing all optional whitespace and punctuation) in the unit tests and the documentation. The former is to increase comprehension by humans learning from these tests, and the latter is to ensure maximal optimization by implementations (over time, if not immediately).

The case noted above ((()!:p)^:p2!:p3 :p4 :o) is especially challenging for a human to parse, as written, but should be fairly easily handled by any relevant software implementation. Filling it out with extra space and/or CRLF characters will increase human comprehension, and should not impact software implementation, though it will increase data volume (which is why these optional characters are expected to be left out of optimized implementations).

(I know I am speaking to people who have already internalized much of what I am asking to be spelled out. My goal is to make everything comprehensible and accessible by people who are new to these topics and serializations.)