Skip to content

Commit ade9bc8

Browse files
authored
Merge pull request #10 from behnam/dev
(v0.3.0) Add `ucd::age` component
2 parents f66e239 + b944d43 commit ade9bc8

File tree

15 files changed

+3422
-13
lines changed

15 files changed

+3422
-13
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unic"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["The UNIC Project Developers"]
55
homepage = "https://github.com/behnam/rust-unic/"
66
repository = "https://github.com/behnam/rust-unic/"
@@ -16,7 +16,7 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }
1616
[workspace]
1717

1818
[dependencies]
19-
unic-ucd = { path = "components/ucd/", version = "0.2.0" }
19+
unic-ucd = { path = "components/ucd/", version = "0.3.0" }
2020
unic-bidi = { path = "components/bidi/", version = "0.2.0" }
2121
unic-idna = { path = "components/idna/", version = "0.2.0" }
2222
unic-normal = { path = "components/normal/", version = "0.2.0" }

components/ucd/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "unic-ucd"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
authors = ["The UNIC Project Developers"]
55
homepage = "https://github.com/behnam/rust-unic/"
66
repository = "https://github.com/behnam/rust-unic/"
@@ -14,6 +14,7 @@ travis-ci = { repository = "behnam/rust-unic", branch = "master" }
1414

1515
[dependencies]
1616
unic-ucd-core = { path = "core/", version = "0.2.0" }
17+
unic-ucd-age = { path = "age/", version = "0.3.0" }
1718
unic-ucd-bidi = { path = "bidi/", version = "0.2.0" }
1819
unic-ucd-normal = { path = "normal/", version = "0.2.0" }
1920
unic-ucd-utils = { path = "utils/", version = "0.2.0" }

components/ucd/age/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "unic-ucd-age"
3+
version = "0.3.0"
4+
authors = ["The UNIC Project Developers"]
5+
homepage = "https://github.com/behnam/rust-unic/"
6+
repository = "https://github.com/behnam/rust-unic/"
7+
license = "MIT/Apache-2.0"
8+
keywords = ["text", "unicode"]
9+
description = "UNIC - Unicode Character Database - Age"
10+
11+
[badges]
12+
travis-ci = { repository = "behnam/rust-unic", branch = "master" }
13+
14+
[dependencies]
15+
unic-ucd-core = { path = "../core/", version = "0.2.0" }

components/ucd/age/src/lib.rs

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
// Copyright 2015 The Servo Project Developers.
2+
// Copyright 2017 The UNIC Project Developers.
3+
//
4+
// See the COPYRIGHT file at the top-level directory of this distribution.
5+
//
6+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
// option. This file may not be copied, modified, or distributed
10+
// except according to those terms.
11+
12+
13+
#![forbid(unsafe_code)]
14+
#![deny(missing_docs)]
15+
16+
//! # UNIC — UCD — Age
17+
//!
18+
//! A component of [`unic`: Unicode and Internationalization Crates for Rust](/unic/).
19+
//!
20+
//! Accessor for `Age` property from Unicode Character Database (UCD)
21+
22+
23+
mod tables;
24+
mod traits;
25+
26+
pub use tables::UNICODE_VERSION;
27+
pub use tables::Age;
28+
pub use traits::CharAge;
29+
30+
31+
#[cfg(test)]
32+
mod tests {
33+
use super::Age;
34+
35+
#[test]
36+
fn test_age() {
37+
use Age::*;
38+
39+
// ASCII
40+
assert_eq!(Age::of('\u{0000}'), V1_1);
41+
assert_eq!(Age::of('\u{0021}'), V1_1);
42+
assert_eq!(Age::of('\u{0041}'), V1_1);
43+
assert_eq!(Age::of('\u{007f}'), V1_1);
44+
45+
assert_eq!(Age::of('\u{0100}'), V1_1);
46+
assert_eq!(Age::of('\u{01f5}'), V1_1);
47+
assert_eq!(Age::of('\u{037e}'), V1_1); // start == end
48+
assert_eq!(Age::of('\u{200c}'), V1_1);
49+
50+
assert_eq!(Age::of('\u{01f6}'), V3_0);
51+
assert_eq!(Age::of('\u{01f7}'), V3_0);
52+
assert_eq!(Age::of('\u{01f9}'), V3_0);
53+
54+
assert_eq!(Age::of('\u{0860}'), V10_0);
55+
assert_eq!(Age::of('\u{0866}'), V10_0);
56+
assert_eq!(Age::of('\u{086a}'), V10_0);
57+
58+
assert_eq!(Age::of('\u{fffe}'), V1_1);
59+
assert_eq!(Age::of('\u{ffff}'), V1_1);
60+
61+
assert_eq!(Age::of('\u{10000}'), V4_0);
62+
assert_eq!(Age::of('\u{10001}'), V4_0);
63+
64+
assert_eq!(Age::of('\u{e0100}'), V4_0);
65+
assert_eq!(Age::of('\u{e0101}'), V4_0);
66+
assert_eq!(Age::of('\u{e0170}'), V4_0);
67+
assert_eq!(Age::of('\u{e01ee}'), V4_0);
68+
assert_eq!(Age::of('\u{e01ef}'), V4_0);
69+
70+
assert_eq!(Age::of('\u{efffd}'), Unassigned);
71+
72+
assert_eq!(Age::of('\u{efffe}'), V2_0);
73+
assert_eq!(Age::of('\u{effff}'), V2_0);
74+
75+
// Priavte-Use Area
76+
assert_eq!(Age::of('\u{f0000}'), V2_0);
77+
assert_eq!(Age::of('\u{f0001}'), V2_0);
78+
assert_eq!(Age::of('\u{ffffe}'), V2_0);
79+
assert_eq!(Age::of('\u{fffff}'), V2_0);
80+
assert_eq!(Age::of('\u{100000}'), V2_0);
81+
assert_eq!(Age::of('\u{100001}'), V2_0);
82+
assert_eq!(Age::of('\u{10fffe}'), V2_0);
83+
assert_eq!(Age::of('\u{10ffff}'), V2_0);
84+
}
85+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// WARNING: Auto-generated by `tools/gen_ucd_tables.py`. DO NOT EDIT MANUALLY!
2+
{
3+
V10_0,
4+
V1_1,
5+
V2_0,
6+
V2_1,
7+
V3_0,
8+
V3_1,
9+
V3_2,
10+
V4_0,
11+
V4_1,
12+
V5_0,
13+
V5_1,
14+
V5_2,
15+
V6_0,
16+
V6_1,
17+
V6_2,
18+
V6_3,
19+
V7_0,
20+
V8_0,
21+
V9_0,
22+
}

0 commit comments

Comments
 (0)