summaryrefslogtreecommitdiff
path: root/oryxc
diff options
context:
space:
mode:
Diffstat (limited to 'oryxc')
-rw-r--r--oryxc/src/unistr.rs20
1 files changed, 13 insertions, 7 deletions
diff --git a/oryxc/src/unistr.rs b/oryxc/src/unistr.rs
index 1d8463d..158fed1 100644
--- a/oryxc/src/unistr.rs
+++ b/oryxc/src/unistr.rs
@@ -46,13 +46,9 @@ impl PartialEq for UniStr<'_> {
== IsNormalized::Yes,
) {
(true, true) => self.0 == other.0,
- (true, false) => {
- self.0.chars().map(|b| b as char).eq(other.0.nfkd())
- },
- (false, true) => {
- self.0.nfkd().eq(other.0.chars().map(|b| b as char))
- },
- (false, false) => self.0.nfkd().eq(other.0.nfkd()),
+ (true, false) => self.0.chars() == other.0.nfkd(),
+ (false, true) => self.0.nfkd() == other.0.chars(),
+ (false, false) => self.0.nfkd() == other.0.nfkd(),
};
}
}
@@ -74,6 +70,11 @@ mod tests {
assert_eq!(UniStr("fishi"), UniStr("fishᵢ"));
assert_eq!(UniStr("fishᵢ"), UniStr("fishᵢ"));
assert_eq!(UniStr("corné"), UniStr("corné"));
+ assert_eq!(UniStr("fishᵢ"), UniStr("fishi"));
+ assert_eq!(UniStr("fishi"), UniStr("fishi"));
+ assert_eq!(UniStr("fishᵢ"), UniStr("fishi"));
+ assert_eq!(UniStr("fishᵢ"), UniStr("fishᵢ"));
+ assert_eq!(UniStr("corné"), UniStr("corné"));
}
#[test]
@@ -84,6 +85,11 @@ mod tests {
(UniStr("fishi"), UniStr("fishᵢ")),
(UniStr("fishᵢ"), UniStr("fishᵢ")),
(UniStr("corné"), UniStr("corné")),
+ (UniStr("fishᵢ"), UniStr("fishi")),
+ (UniStr("fishi"), UniStr("fishi")),
+ (UniStr("fishᵢ"), UniStr("fishi")),
+ (UniStr("fishᵢ"), UniStr("fishᵢ")),
+ (UniStr("corné"), UniStr("corné")),
] {
let mut hashl = DefaultHasher::new();
let mut hashr = DefaultHasher::new();