servo / unicode-bidi

Implementation of the Unicode Bidirection Algorithm in Rust
Other
77 stars 33 forks source link

Add conformance tests #1

Closed mbrubeck closed 7 years ago

mbrubeck commented 9 years ago

The Unicode consortium has a suite of conformance tests for the bidirectional algorithm, which can be found at:

We should add code to tools/generate.py to download these files and generate Rust unit tests for each of the test cases here.

vicky-katara commented 8 years ago

@mbrubeck , @eefriedman, I am working on generating Rust unit test cases from BidiCharacterTest.txt, and the test cases essentially use the Fields 0(input string) and 4(output indices converted to output strings) and form unit test cases of the form "assert_eq!(reorder('input'), 'output');". Could you confirm whether this is correct? I am ignoring the levels information in the test cases since those should essentially be taken care of by the implementation.

Thanks!

mbrubeck commented 8 years ago

Yes, this sounds good. Checking the levels may be useful too in some cases, but just checking the output is the most improtant part.

On Fri, Nov 27, 2015 at 2:19 PM, Vicky Katara notifications@github.com wrote:

@mbrubeck https://github.com/mbrubeck , I am working on generating Rust unit test cases from BidiCharacterTest.txt, and the test cases essentially use the Fields 0(input string) and 4(output indices converted to output strings) and form unit test cases of the form "assert_eq!(reorder('input'), 'output');". Could you confirm whether this is correct? I am ignoring the levels information in the test cases since those should essentially be taken care of by the implementation.

Thanks!

— Reply to this email directly or view it on GitHub https://github.com/servo/unicode-bidi/issues/1#issuecomment-160219271.

vicky-katara commented 8 years ago

@mbrubeck, thanks for the confirmation. I had a followup question to the main issue. Since the files BidiTest.txt and BidiCharacterTest.txt are live, we will have to write python code which parses the files for test cases each time, and deletes the automated test cases added previously to lib.rs, and lastly add the new ones. Is this correct?

mbrubeck commented 8 years ago

We should re-parse and re-generate the test cases only if someone manually runs the script to do it. See this discussion for more details.

vicky-katara commented 8 years ago

Got it!

Thanks a lot!

vicky-katara commented 8 years ago

@mbrubeck, should we add the python code for insertion of the test cases into a new python file, or should we add code to generate.py?

mbrubeck commented 8 years ago

Either way is okay with me. If it's a lot of code (more than a handful of short functions), a separate file would probably be more readable. generate.py could import the other file.

vicky-katara commented 8 years ago

Combined with the code for deletion of existing test cases, it comes out to about 150 lines of code...

We'll move it to another file. Thanks @mbrubeck

samruds1 commented 8 years ago

@mbrubeck - Is it possible for us to have a Hangouts session or for us to call you? We have some doubts regarding the steps we have to implement as well as this step.

mbrubeck commented 8 years ago

@samrudhisharma Sure, if you're available sometime today. You can find me in #servo on irc.mozilla.org to arrange a time, or just try calling +Matt Brubeck on Google Hangouts.