Skip to content

Commit

Permalink
[tests] Add test for gen_char_from_bidi_class()
Browse files Browse the repository at this point in the history
  • Loading branch information
behnam committed May 12, 2017
1 parent 1508534 commit 19d9858
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion tests/conformance_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;

use unicode_bidi::{BidiInfo, format_chars, Level, process_text};
use unicode_bidi::{bidi_class, BidiInfo, format_chars, Level, process_text};

const TEST_DATA_DIR: &str = "tests/data";
const BASE_TEST_FILE_NAME: &str = "BidiTest.txt";
Expand Down Expand Up @@ -196,3 +196,37 @@ fn gen_char_from_bidi_class(class_name: &str) -> char {
&_ => panic!("Invalid Bidi_Class name: {}", class_name),
}
}

#[test]
fn test_gen_char_from_bidi_class() {
use unicode_bidi::BidiClass::*;
for class in vec![
AL,
AN,
B,
BN,
CS,
EN,
ES,
ET,
FSI,
L,
LRE,
LRI,
LRO,
NSM,
ON,
PDF,
PDI,
R,
RLE,
RLI,
RLO,
S,
WS,
] {
let class_name = format!("{:?}", class);
let sample_char = gen_char_from_bidi_class(&class_name);
assert_eq!(bidi_class(sample_char), class);
}
}

0 comments on commit 19d9858

Please sign in to comment.