File: 32_nfkc_3_2.t

package info (click to toggle)
libunicode-stringprep-perl 1.104%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 284 kB
  • sloc: perl: 3,558; sh: 48; makefile: 2
file content (62 lines) | stat: -rw-r--r-- 1,701 bytes parent folder | download | duplicates (4)
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 strict;
use utf8;

no warnings 'utf8';

use Test::More;
use Test::NoWarnings;

use Unicode::Stringprep;

my @data; while(<DATA>) {
  my @c = map { s/^\s+|\s+$//g;$_; } split m/;/, $_, 3;
  push @data, \@c if $#c > 1;
}

plan tests => ($#data+1) + 2;
ok($#data > 2, 'number of test patterns');

my $func = Unicode::Stringprep->new('3.2', undef, 'KC');

foreach my $d (@data) {
  $d->[2] = sprintf('U+%s - %s', uc($d->[0]), $d->[2]) 
    unless $d->[0] =~ m/\s/;

  $d->[1] ||= $d->[0];

  foreach my $c (0..1) {
    if($d->[$c] =~ m/undef/) {
      $d->[$c] = undef; 
      next;
    }
    $d->[$c] = join '',
      map { chr hex $_ }
	grep { length($_) > 0 }
          split /\s+/, $d->[$c];
  }
  is( eval{ $func->($d->[0]) }, $d->[1], $d->[2] );
};
exit(0);

__DATA__

F951; 964B; Erroneous mapping (Corrigendum 3, corrected in Unicode 3.2)

2F868; 2136A; Erroneous mapping (Corrigendum 4, corrected in Unicode 4.0)
2F874; 5F33; Erroneous mapping (Corrigendum 4, corrected in Unicode 4.0)
2F91F; 43AB; Erroneous mapping (Corrigendum 4, corrected in Unicode 4.0)
2F95F; 7AAE; Erroneous mapping (Corrigendum 4, corrected in Unicode 4.0)
2F9BF; 4D57; Erroneous mapping (Corrigendum 4, corrected in Unicode 4.0)

2047; 3F 3F; DOUBLE QUESTION MARK (added in 3.2)
205F; 20; MEDIUM MATHEMATICAL SPACE (added in 3.2)
30FF; 30B3 30C8; KATAKANA DIGRAPH KOTO (added in 3.2)
2ADC; 2ADD 0338; FORKING (added in 3.2)
1D15E; 1D157 1D165; MUSICAL SYMBOL HALF NOTE (added in 3.1)

213B;; FACSIMILE SIGN (added in 4.0)
1EA5 35D 329;; No reordering for U+035D (added in 4.0)

0B47 0300 0B3E; undef; PR 29 test case 1
1100 0300 1161; undef; PR 29 test case 2
1100 0300 1161 0323; undef; PR 29 test case 2, expanded