File: encode.rs

package info (click to toggle)
rust-codepage-437 0.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 332 kB
  • sloc: makefile: 4
file content (25 lines) | stat: -rw-r--r-- 583 bytes parent folder | download
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
use self::super::super::{VARIANTS_CP437, VARIANTS_UTF8, ALL_UTF8};
use self::super::super::super::ALL_CP437;
use codepage_437::CP437_CONTROL;


#[test]
fn normal() {
    for (&b, c) in ALL_CP437.iter().zip(ALL_UTF8.chars()) {
        assert_eq!(CP437_CONTROL.encode(c), Some(b));
    }
}

#[test]
fn variants() {
    for (&b, c) in VARIANTS_CP437.iter().zip(VARIANTS_UTF8.chars()) {
        assert_eq!(CP437_CONTROL.encode(c), Some(b));
    }
}

#[test]
fn unmapped() {
    for c in "ĄĘĆŹŻŃŁąęćźżńł".chars() {
        assert_eq!(CP437_CONTROL.encode(c), None);
    }
}