-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_convert_tekken.rs
44 lines (38 loc) · 1.12 KB
/
test_convert_tekken.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Test for the conversion of tekken models.
use kitoken::{Definition, Kitoken};
mod util;
use util::*;
#[test]
fn test_serialize_deserialize() {
init_env();
eprintln!();
for model in test_models("tekken", "json") {
log::info!("converting: {}", model.to_string_lossy());
let data = std::fs::read(model).unwrap();
let definition1 = Definition::from_slice(&data).unwrap();
let tokenizer = Kitoken::from_definition(definition1.clone()).unwrap();
let definition2 = tokenizer.to_definition();
test_definitions_same(definition1, definition2);
}
}
#[test]
fn test_small_lines() {
init_env();
test_encode_decode_lines("tekken", "json", "small", false, |model| {
Kitoken::from_tekken_file(model).unwrap()
})
}
#[test]
fn test_utf8_full() {
init_env();
test_encode_decode_full("tekken", "json", "utf8", false, |model| {
Kitoken::from_tekken_file(model).unwrap()
})
}
#[test]
fn test_mixed_lines() {
init_env();
test_encode_decode_lines("tekken", "json", "mixed", false, |model| {
Kitoken::from_tekken_file(model).unwrap()
})
}