Skip to content

Commit

Permalink
Merge pull request #10 from behnam/dev
Browse files Browse the repository at this point in the history
(v0.3.0) Add `ucd::age` component
  • Loading branch information
behnam authored Jun 22, 2017
2 parents f66e239 + b944d43 commit ade9bc8
Show file tree
Hide file tree
Showing 15 changed files with 3,422 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "unic"
version = "0.2.0"
version = "0.3.0"
authors = ["The UNIC Project Developers"]
homepage = "https://github.com/behnam/rust-unic/"
repository = "https://github.com/behnam/rust-unic/"
Expand All @@ -16,7 +16,7 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }
[workspace]

[dependencies]
unic-ucd = { path = "components/ucd/", version = "0.2.0" }
unic-ucd = { path = "components/ucd/", version = "0.3.0" }
unic-bidi = { path = "components/bidi/", version = "0.2.0" }
unic-idna = { path = "components/idna/", version = "0.2.0" }
unic-normal = { path = "components/normal/", version = "0.2.0" }
Expand Down
3 changes: 2 additions & 1 deletion components/ucd/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "unic-ucd"
version = "0.2.0"
version = "0.3.0"
authors = ["The UNIC Project Developers"]
homepage = "https://github.com/behnam/rust-unic/"
repository = "https://github.com/behnam/rust-unic/"
Expand All @@ -14,6 +14,7 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }

[dependencies]
unic-ucd-core = { path = "core/", version = "0.2.0" }
unic-ucd-age = { path = "age/", version = "0.3.0" }
unic-ucd-bidi = { path = "bidi/", version = "0.2.0" }
unic-ucd-normal = { path = "normal/", version = "0.2.0" }
unic-ucd-utils = { path = "utils/", version = "0.2.0" }
15 changes: 15 additions & 0 deletions components/ucd/age/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[package]
name = "unic-ucd-age"
version = "0.3.0"
authors = ["The UNIC Project Developers"]
homepage = "https://github.com/behnam/rust-unic/"
repository = "https://github.com/behnam/rust-unic/"
license = "MIT/Apache-2.0"
keywords = ["text", "unicode"]
description = "UNIC - Unicode Character Database - Age"

[badges]
travis-ci = { repository = "behnam/rust-unic", branch = "master" }

[dependencies]
unic-ucd-core = { path = "../core/", version = "0.2.0" }
85 changes: 85 additions & 0 deletions components/ucd/age/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright 2015 The Servo Project Developers.
// Copyright 2017 The UNIC Project Developers.
//
// See the COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.


#![forbid(unsafe_code)]
#![deny(missing_docs)]

//! # UNIC — UCD — Age
//!
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
//!
//! Accessor for `Age` property from Unicode Character Database (UCD)

mod tables;
mod traits;

pub use tables::UNICODE_VERSION;
pub use tables::Age;
pub use traits::CharAge;


#[cfg(test)]
mod tests {
use super::Age;

#[test]
fn test_age() {
use Age::*;

// ASCII
assert_eq!(Age::of('\u{0000}'), V1_1);
assert_eq!(Age::of('\u{0021}'), V1_1);
assert_eq!(Age::of('\u{0041}'), V1_1);
assert_eq!(Age::of('\u{007f}'), V1_1);

assert_eq!(Age::of('\u{0100}'), V1_1);
assert_eq!(Age::of('\u{01f5}'), V1_1);
assert_eq!(Age::of('\u{037e}'), V1_1); // start == end
assert_eq!(Age::of('\u{200c}'), V1_1);

assert_eq!(Age::of('\u{01f6}'), V3_0);
assert_eq!(Age::of('\u{01f7}'), V3_0);
assert_eq!(Age::of('\u{01f9}'), V3_0);

assert_eq!(Age::of('\u{0860}'), V10_0);
assert_eq!(Age::of('\u{0866}'), V10_0);
assert_eq!(Age::of('\u{086a}'), V10_0);

assert_eq!(Age::of('\u{fffe}'), V1_1);
assert_eq!(Age::of('\u{ffff}'), V1_1);

assert_eq!(Age::of('\u{10000}'), V4_0);
assert_eq!(Age::of('\u{10001}'), V4_0);

assert_eq!(Age::of('\u{e0100}'), V4_0);
assert_eq!(Age::of('\u{e0101}'), V4_0);
assert_eq!(Age::of('\u{e0170}'), V4_0);
assert_eq!(Age::of('\u{e01ee}'), V4_0);
assert_eq!(Age::of('\u{e01ef}'), V4_0);

assert_eq!(Age::of('\u{efffd}'), Unassigned);

assert_eq!(Age::of('\u{efffe}'), V2_0);
assert_eq!(Age::of('\u{effff}'), V2_0);

// Priavte-Use Area
assert_eq!(Age::of('\u{f0000}'), V2_0);
assert_eq!(Age::of('\u{f0001}'), V2_0);
assert_eq!(Age::of('\u{ffffe}'), V2_0);
assert_eq!(Age::of('\u{fffff}'), V2_0);
assert_eq!(Age::of('\u{100000}'), V2_0);
assert_eq!(Age::of('\u{100001}'), V2_0);
assert_eq!(Age::of('\u{10fffe}'), V2_0);
assert_eq!(Age::of('\u{10ffff}'), V2_0);
}
}
22 changes: 22 additions & 0 deletions components/ucd/age/src/tables/age_type.rsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// WARNING: Auto-generated by `tools/gen_ucd_tables.py`. DO NOT EDIT MANUALLY!
{
V10_0,
V1_1,
V2_0,
V2_1,
V3_0,
V3_1,
V3_2,
V4_0,
V4_1,
V5_0,
V5_1,
V5_2,
V6_0,
V6_1,
V6_2,
V6_3,
V7_0,
V8_0,
V9_0,
}
Loading

0 comments on commit ade9bc8

Please sign in to comment.