| 1 |
#!perl |
| 2 |
# gen-ta : auxiliary script for Tamil |
| 3 |
# |
| 4 |
# output files |
| 5 |
# |
| 6 |
# ta.txt (equal to data/ta.txt) |
| 7 |
# loc_ta.t (equal to t/loc_ta.t) |
| 8 |
# |
| 9 |
use strict; |
| 10 |
use warnings; |
| 11 |
require './gen-head'; # for testcount() and testhead() |
| 12 |
|
| 13 |
my @consonant = qw(B95 B99 B9A B9E B9F BA3 BA4 BA8 BAA BAE BAF BB0 |
| 14 |
BB2 BB5 BB4 BB3 BB1 BA9 B9C BB6 BB7 BB8 BB9 ); |
| 15 |
my @aftercons = qw(Kssa BBE); |
| 16 |
|
| 17 |
my $textf = 'ta.txt'; |
| 18 |
my $text1 = "0B82;<0B83>+0 [.FFF0.0.0.0]\n0B83;<0B83>+0 [.FFF1.0.0.0]\n"; |
| 19 |
my $text2 = ''; |
| 20 |
my $testf = 'loc_ta.t'; |
| 21 |
my $test1 = << 'TEST'; |
| 22 |
no warnings 'utf8'; |
| 23 |
my $t = $h ? _pack_U(0xFFFF) : ""; |
| 24 |
$objTa->change(highestFFFF => 1) if $h; |
| 25 |
|
| 26 |
ok($objTa->lt("\x{B94}$t", "\x{B82}")); |
| 27 |
ok($objTa->lt("\x{B82}$t", "\x{B83}")); |
| 28 |
TEST |
| 29 |
|
| 30 |
my $type = 'c'; |
| 31 |
my $pre = '\x{B83}'; |
| 32 |
my $p = ''; |
| 33 |
for my $c (@consonant, @aftercons) { |
| 34 |
$type = '' if $c eq 'Kssa'; |
| 35 |
my $u = $c eq 'Kssa' ? '0B95 0BCD 0BB7' : "0$c"; |
| 36 |
my $hex = $c eq 'Kssa' ? "\${$c}" : "\\x{$c}"; |
| 37 |
|
| 38 |
if ($c eq 'Kssa') { |
| 39 |
$text1 .= "$u 0BCD;<$p>+0 [.FFF2.0.0.0]\n"; |
| 40 |
$text1 .= "$u ;<$p>+0 [.FFF3.0.0.0]\n"; |
| 41 |
} |
| 42 |
if ($type eq 'c') { |
| 43 |
$text2 .= "$u 0BCD;<$u>+0 [.FFF0.0.0.0]\n"; |
| 44 |
$text2 .= "$u ;<$u>+0 [.FFF1.0.0.0]\n"; |
| 45 |
} |
| 46 |
|
| 47 |
if ($c eq 'BBE') { |
| 48 |
$test1 .= qq| ok(\$objTa->lt("$pre\$t", "$hex"));\n|; |
| 49 |
} else { |
| 50 |
$test1 .= qq| ok(\$objTa->lt("$pre\$t", "$hex\$v"));\n|; |
| 51 |
$test1 .= qq| ok(\$objTa->lt("$hex\$v\$t",\ "$hex"));\n|; |
| 52 |
} |
| 53 |
|
| 54 |
$p = $u; |
| 55 |
$pre = $hex; |
| 56 |
} |
| 57 |
|
| 58 |
### WRITE DATA ### |
| 59 |
open my $dh, ">$textf" or die $textf; |
| 60 |
binmode $dh; |
| 61 |
print $dh "$text1$text2"; |
| 62 |
close $dh or die $textf; |
| 63 |
|
| 64 |
### WRITE TEST ### |
| 65 |
my $test = ''; |
| 66 |
my $ok = 2; |
| 67 |
|
| 68 |
$test .= "\$objTa->change(level => 1);\n\n"; |
| 69 |
$test .= 'my $Kssa = "\x{B95}\x{BCD}\x{BB7}";'."\n"; |
| 70 |
$test .= 'my $v = "\x{BCD}";'."\n\n"; |
| 71 |
$test .= qq|for my \$h (0, 1) |; |
| 72 |
$test .= testcount(\$ok, $test1, 2); |
| 73 |
|
| 74 |
chomp $test; |
| 75 |
open my $th, ">$testf" or die $testf; |
| 76 |
binmode $th; |
| 77 |
print $th testhead('ta', $ok), $test; |
| 78 |
close $th or die $testf; |