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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
use crate::{align, delta};
#[test]
fn test_aline() {
assert_eq!(
align("θin", "tenwis", 0.0),
vec![
vec![("θ", "t"), ("i", "e"), ("n", "n")]
.iter()
.map(|(a, b)| (a.to_string(), b.to_string()))
.collect::<Vec<(String, String)>>()
]
);
assert_eq!(
align("jo", "ʒə", 0.0),
vec![
vec![("j", "ʒ"), ("o", "ə")]
.iter()
.map(|(a, b)| (a.to_string(), b.to_string()))
.collect::<Vec<(String, String)>>()
]
);
assert_eq!(
align("pematesiweni", "pematesewen", 0.0),
vec![
vec![
("p", "p"),
("e", "e"),
("m", "m"),
("a", "a"),
("t", "t"),
("e", "e"),
("s", "s"),
("i", "e"),
("w", "w"),
("e", "e"),
("n", "n"),
]
.iter()
.map(|(a, b)| (a.to_string(), b.to_string()))
.collect::<Vec<(String, String)>>()
]
);
assert_eq!(
align("tuwθ", "dentis", 0.0),
vec![
vec![("t", "t"), ("u", "i"), ("w", "-"), ("θ", "s")]
.iter()
.map(|(a, b)| (a.to_string(), b.to_string()))
.collect::<Vec<(String, String)>>()
]
)
}
#[test]
fn test_aline_deltas() {
assert_eq!(delta("p", "q"), 20.0);
assert_eq!(delta("a", "A"), 0.0);
}
|