Add Conformance Test and implement L1 rule#30
Conversation
|
|
||
| let mut levels = self.levels.clone(); | ||
|
|
||
| // Reset some whitespace chars to paragraph level. |
There was a problem hiding this comment.
Here's the L1 implementation.
The `Level` struct always represents a valid bidi embedding level, with checks for explicit and implicit boundries (max_depth and max_depth+1, respectively) therefore can fail on `new*()` and mutation (`raise*()`/`lower()`) methods. So, we have one level type, which is always a valid number of *implicit embedding level resolution*, but can be made invalid for *explicit embedding level resolution*. This is fine because external usage of the data structure would normally deal with the final resolved levels, which are the *implicit* ones (and that's why its boundry is made the implicit boundry here, as well), and the *explicit* bounrdy is supposed to be checked only during the early stages of the algorithm (the explicit stages), which can do so explicitly by calling the appropriate methods.
9907c1d to
e20e2c0
Compare
79d1a87 to
a59b450
Compare
To be able to implement L1, we need access to more information from `BidiInfo`, namely `original_classes` of the `text`, in `visual_runs()`, which would mean it should pass through `reorder_line()`. The fact that information from `BidiInfo` is needed for both steps of the public API (generating `BidiInfo` and consuming it per-paragraph/per-level) made me change the API design and move these methods into `impl BidiInfo`. Then, since we needed access to `text` for every `BidiInfo` consumption, I added a reference to `text` to `BidiInfo`, which also enables more compile-time checks for `BidiInfo` isntance not outliving the text in the user code. NOTE: We are already breaking API in version 0.3.0 and paving for full spec support is a good reason to do so, IMHO. The L1 rule works by one pass on the text of the line. Conformance Test: this implementation reduces the number of failures from 60494 to 23770 (out of total 256747 cases). Fix #2
|
Actually, found a bug in my L1 code that just fixed, updating the conf-test results: |
|
Dependents status:
|
|
@bors-servo r+ This is great, thanks! Do you have any more changes planned before we publish version 0.3.0? |
|
📌 Commit 6427532 has been approved by |
Add Conformance Test and implement L1 rule Initial results: `60494 test cases failed! (196253 passed)` Because of the current limitations of rust's test framework, and the huge number of failures, the base (not including matching pairs) conformance test is executed in one run, and a summary is panic'ed (if there's any failure) and for the integration test to pass, it's marked as `should_panic`, with summary of the test run as `expected` string. Fix #1 To be able to implement L1, we need access to more information from `BidiInfo`, namely `original_classes` of the `text`, in `visual_runs()`, which would mean it should pass through `reorder_line()`. The fact that information from `BidiInfo` is needed for both steps of the public API (generating `BidiInfo` and consuming it per-paragraph/per-level) made me change the API design and move these methods into `impl BidiInfo`. Then, since we needed access to `text` for every `BidiInfo` consumption, I added a reference to `text` to `BidiInfo`, which also enables more compile-time checks for `BidiInfo` isntance not outliving the text in the user code. NOTE: We are already breaking API in version 0.3.0 and paving for full spec support is a good reason to do so, IMHO. The L1 rule works by one pass on the text of the line. Conformance Test: this implementation reduces the number of failures from 60494 to 23770 (out of total 256747 cases). Fix #2 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/unicode-bidi/30) <!-- Reviewable:end -->
|
☀️ Test successful - status-travis |
|
Thanks for the review, @mbrubeck. Here's what I have in mind right now:
I think I need a little help with the serde support, as looks like the current servo repo depends on serde So, the question is, are there any cases where a serde data from Right now, I'm organizing serde implementation as two features: Also, I can see that https://github.com/serde-rs/legacy and relevant crates enable support for multiple versions of serde being linked, but I'm not sure how to do a similar thing for the serde_derive macros. So, in short: if we only need either |
No, I don't think we need to support this. |
Add conformance tests using BidiTest.txt
Initial results:
60494 test cases failed! (196253 passed)Because of the current limitations of rust's test framework, and the huge number of failures, the base (not including matching pairs) conformance test is executed in one run, and a summary is panic'ed (if there's any failure) and for the integration test to pass, it's marked as
should_panic, with summary of the test run asexpectedstring.Fix #1
Implement L1 rule
To be able to implement L1, we need access to more information from
BidiInfo, namelyoriginal_classesof thetext, invisual_runs(),which would mean it should pass through
reorder_line().The fact that information from
BidiInfois needed for both steps ofthe public API (generating
BidiInfoand consuming itper-paragraph/per-level) made me change the API design and move these
methods into
impl BidiInfo.Then, since we needed access to
textfor everyBidiInfoconsumption,I added a reference to
texttoBidiInfo, which also enables morecompile-time checks for
BidiInfoisntance not outliving the text inthe user code.
NOTE: We are already breaking API in version 0.3.0 and paving for full
spec support is a good reason to do so, IMHO.
The L1 rule works by one pass on the text of the line.
Conformance Test: this implementation reduces the number of failures
from 60494 to 23770 (out of total 256747 cases).
Fix #2
This change is