Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CharProperty: API to get all possible values, if applicable #66

Closed
behnam opened this issue Jul 31, 2017 · 4 comments
Closed

CharProperty: API to get all possible values, if applicable #66

behnam opened this issue Jul 31, 2017 · 4 comments
Milestone

Comments

@behnam
Copy link
Member

behnam commented Jul 31, 2017

Some properties, like GeneralCategory and BidiClass, are a flat enum, and having a type function returning all possible values of them can help with writing tests.

For example, having an iterator over GC values can reduce this test to 20 execs of the loop block, not all Unicode code points: https://github.com/behnam/rust-unic/blob/master/unic/ucd/category/tests/coverage_tests.rs

@calum
Copy link

calum commented Jul 31, 2017

I'm interested in this one, if it's not already being worked on.

Just to clarify: as an example, you want a function to return all chars that are GC::MathSymbol. Or, do you want a function to return all chars that are GC.is_letter().

@calum
Copy link

calum commented Jul 31, 2017

I've thought about it a bit more now and you actually want a function which takes a char and returns all the types it fits into? Do you want a different function for BidiClass and GeneralCategory, or one function to return all the possible values from both?

@behnam
Copy link
Member Author

behnam commented Jul 31, 2017

Thanks, @calum, for the interest. The thing is that I filed this issue as a tracker for the feature, which is going to be implemented by the macros @CAD97 and I are working on. We are building tools to auto-generate most of the code that's already manually-generated, so we don't have to maintain the little things, like the feature mentioned here, manually.

There are a couple of other good starter tasks that I recommend. Let me comment there for you.

behnam added a commit that referenced this issue Aug 4, 2017
The `all_values()` static function is a new API for character
properties implemented as *flat* `enum` types in Rust, like some of
Unicode properties of type *Catalog* or *Enumeration*, to return an
exhaustive list of all possible values.

The function is useful mainly in writing integration tests, but since is
efficient in implementation, can be used in application logic, as well.

The current list is manually created and maintained. With migration to
`char_property` macros, the list will be auto-generated. (Possibly
stored in a private module and only exposed via `all_values()` API.)

See <#66>
behnam added a commit that referenced this issue Aug 4, 2017
The `all_values()` static function is a new API for character
properties implemented as *flat* `enum` types in Rust, like some of
Unicode properties of type *Catalog* or *Enumeration*, to return an
exhaustive list of all possible values.

The function is useful mainly in writing integration tests, but since is
efficient in implementation, can be used in application logic, as well.

The current list is manually created and maintained. With migration to
`char_property` macros, the list will be auto-generated. (Possibly
stored in a private module and only exposed via `all_values()` API.)

See <#66>
@behnam
Copy link
Member Author

behnam commented Aug 4, 2017

We have the API in and there's an integration test using it, so we can track the implementation directly in the code.

@behnam behnam closed this as completed Aug 4, 2017
@behnam behnam added this to the UNIC-0.5 milestone Aug 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants