r50410 - in /branches/upstream/liblingua-es-numeros-perl/current: Changes META.yml lib/Lingua/ES/Numeros.pm t/t02_cardinals.t t/t04_ordinals.t

angelabad-guest at users.alioth.debian.org angelabad-guest at users.alioth.debian.org
Wed Jan 6 23:20:27 UTC 2010


Author: angelabad-guest
Date: Wed Jan  6 23:20:14 2010
New Revision: 50410

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50410
Log:
[svn-upgrade] Integrating new upstream version, liblingua-es-numeros-perl (0.07)

Modified:
    branches/upstream/liblingua-es-numeros-perl/current/Changes
    branches/upstream/liblingua-es-numeros-perl/current/META.yml
    branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm
    branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t
    branches/upstream/liblingua-es-numeros-perl/current/t/t04_ordinals.t

Modified: branches/upstream/liblingua-es-numeros-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/Changes?rev=50410&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/Changes (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/Changes Wed Jan  6 23:20:14 2010
@@ -1,4 +1,8 @@
 Revision history for Perl extension Lingua::ES::Numeros.
+
+0.07  Wed Jan  6 00:14:36 VET 2010
+    - Corrected fractional formating bug in real() thanks to Joaquin Ferrero
+    - Corrected female hundreths under one million
 
 0.06  Sun Sep  6 18:58:32 VET 2009
     - Correct spelling for 2 from dós to dos

Modified: branches/upstream/liblingua-es-numeros-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/META.yml?rev=50410&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/META.yml (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/META.yml Wed Jan  6 23:20:14 2010
@@ -1,11 +1,22 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
-name:         Lingua-ES-Numeros
-version:      0.06
-version_from: lib/Lingua/ES/Numeros.pm
-installdirs:  site
+--- #YAML:1.0
+name:               Lingua-ES-Numeros
+version:            0.07
+abstract:           Translates numbers to spanish text
+author:
+    - Jose Rey <jrey at cpan.org>
+license:            unknown
+distribution_type:  module
+configure_requires:
+    ExtUtils::MakeMaker:  0
+build_requires:
+    ExtUtils::MakeMaker:  0
 requires:
-    Carp:                          0
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30_01
+    Carp:  0
+no_index:
+    directory:
+        - t
+        - inc
+generated_by:       ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+    url:      http://module-build.sourceforge.net/META-spec-v1.4.html
+    version:  1.4

Modified: branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm?rev=50410&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm Wed Jan  6 23:20:14 2010
@@ -39,7 +39,7 @@
 
 our @ISA = qw();
 
-our $VERSION = '0.06';
+our $VERSION = '0.07';
 
 our @EXPORT = qw( MALE FEMALE NEUTRAL );
 
@@ -328,7 +328,7 @@
         /%([0-9]*)d/ && do {
 
             # Numérico, se da formato a los dígitos
-            $frc = substr( '0' x $exp . $frc, 0, $1 );
+            $frc = substr( '0' x $exp . $frc . '0' x $1, 0, $1 );
             $frc = sprintf( $self->{'FORMATO'}, $frc );
             last;
         };
@@ -688,6 +688,14 @@
     $n .= "0" x ( $exp % 6 );    # agregar ceros a la derecha
     my $mag   = int( $exp / 6 );
     my @group = ();
+
+    # Translate the lower 6 digits for female numbers
+    if ($gen eq FEMALE) {
+        $n =~ s/(.{1,6})$//x;
+        $fmag->( $1, \@group, $mag++ );
+        s/cientos$/cientas/g for @group;
+    }
+
     $fmag->( $1, \@group, $mag++ ) while $n =~ s/(.{1,6})$//x;
     $group[0] .= $gen if $group[0] =~ /un$/;
     reverse @group;

Modified: branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t?rev=50410&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t Wed Jan  6 23:20:14 2010
@@ -8,7 +8,7 @@
 use utf8;
 
 #use lib '/home/opr/W/Projects/Numeros/Lingua-ES-Numbers/lib/';
-use Test::More tests => 32168;
+use Test::More tests => 21835;
 BEGIN { use_ok('Lingua::ES::Numeros') }
 
 #########################
@@ -58,15 +58,22 @@
     my $self = shift;
 
     my $obj = Lingua::ES::Numeros->new( GENERO => 'a' );
+    for my $i ( 0 .. 99 ) {
+        my $n = sprintf("%02d", $i);
+        $t = $obj->real("11.$n");
+        is( $t, "once con $n ctms.", "t_real_2" );
+    }
     while ( my ( $k, $v ) = each %$self ) {
         next if $k =~ /^z/;
         my $t = $obj->cardinal($k);
         $v =~ s/un$/una/g;
+        if ( $v =~ s/(.*(?:illones|llón))?(.+)// ) {
+            my ($hi, $lo) = ($1 || '', $2);
+            $lo =~ s/cientos/cientas/g;
+            $v = $hi . $lo;
+        }
         $v = 'cero' if $v eq '';
         is( $t, $v, "t_cardinal_2" );
-
-        $t = $obj->real("$k.16");
-        is( $t, "$v con 16 ctms.", "t_real_2" );
     }
 }
 
@@ -76,18 +83,18 @@
     my $obj = Lingua::ES::Numeros->new( SEXO => 'a' );
     $obj->{'FORMATO'} = "CON %s";
     my $t = $obj->real("124.345");
-    is( $t, "ciento veinticuatro CON trescientos cuarenta y cinco milésimas", "t_real_2" );
+    is( $t, "ciento veinticuatro CON trescientas cuarenta y cinco milésimas", "t_real_2" );
     $obj->{'MAYUSCULAS'} = 1;
     $t = $obj->real("122.345");
-    is( $t, uc "ciento veintidós CON trescientos cuarenta y cinco milésimas", "t_real_2" );
+    is( $t, uc "ciento veintidós CON trescientas cuarenta y cinco milésimas", "t_real_2" );
     $obj->{'HTML'}    = 1;
     $obj->{'DECIMAL'} = ",";
     $t                = $obj->real("122,345");
-    is( $t, uc "ciento veintid&oacute;s CON trescientos cuarenta y cinco mil&eacute;simas",
+    is( $t, uc "ciento veintid&oacute;s CON trescientas cuarenta y cinco mil&eacute;simas",
         "t_real_2" );
     $obj->{'MAYUSCULAS'} = 0;
     $t = $obj->real("122,345");
-    is( $t, "ciento veintid&oacute;s CON trescientos cuarenta y cinco mil&eacute;simas",
+    is( $t, "ciento veintid&oacute;s CON trescientas cuarenta y cinco mil&eacute;simas",
         "t_real_2" );
     eval { $t = $obj->real("122.345") };
     ok( $@ =~ /^Error de sintaxis/, "Real error de sintaxis" );
@@ -97,13 +104,54 @@
     $obj->{'ACENTOS'}    = 0;
     $obj->{'POSITIVO'}   = "positivo";
     $t                   = $obj->real("124.345");
-    is( $t, uc "positivo ciento veinticuatro CON trescientos cuarenta y cinco milesimas",
+    is( $t, uc "positivo ciento veinticuatro CON trescientas cuarenta y cinco milesimas",
         "t_real_2" );
     $obj->{'MAYUSCULAS'} = 0;
     $t = $obj->real("-0.124345e3");
-    is( $t, "menos ciento veinticuatro CON trescientos cuarenta y cinco milesimas", "t_real_2" );
-    $t = $obj->real("-124345e-3");
-    is( $t, "menos ciento veinticuatro CON trescientos cuarenta y cinco milesimas", "t_real_2" );
+    is( $t, "menos ciento veinticuatro CON trescientas cuarenta y cinco milesimas", "t_real_2" );
+    $t = $obj->real("-124345e-3");
+    is( $t, "menos ciento veinticuatro CON trescientas cuarenta y cinco milesimas", "t_real_2" );
+    $t = $obj->real("-0.224345e3");
+    is( $t, "menos doscientas veinticuatro CON trescientas cuarenta y cinco milesimas", "t_real_2" );
+    $t = $obj->real("-224345e-3");
+    is( $t, "menos doscientas veinticuatro CON trescientas cuarenta y cinco milesimas", "t_real_2" );
+
+
+    $obj = Lingua::ES::Numeros->new( GENERO => 'o' );
+    $obj->{'FORMATO'} = "CON %s";
+    $t = $obj->real("124.345");
+    is( $t, "ciento veinticuatro CON trescientos cuarenta y cinco milésimos", "t_real_2" );
+    $obj->{'MAYUSCULAS'} = 1;
+    $t = $obj->real("122.345");
+    is( $t, uc "ciento veintidós CON trescientos cuarenta y cinco milésimos", "t_real_2" );
+    $obj->{'HTML'}    = 1;
+    $obj->{'DECIMAL'} = ",";
+    $t                = $obj->real("122,345");
+    is( $t, uc "ciento veintid&oacute;s CON trescientos cuarenta y cinco mil&eacute;simos",
+        "t_real_2" );
+    $obj->{'MAYUSCULAS'} = 0;
+    $t = $obj->real("122,345");
+    is( $t, "ciento veintid&oacute;s CON trescientos cuarenta y cinco mil&eacute;simos",
+        "t_real_2" );
+    eval { $t = $obj->real("122.345") };
+    ok( $@ =~ /^Error de sintaxis/, "Real error de sintaxis" );
+    $obj->{'DECIMAL'}    = ".";
+    $obj->{'HTML'}       = 0;
+    $obj->{'MAYUSCULAS'} = 1;
+    $obj->{'ACENTOS'}    = 0;
+    $obj->{'POSITIVO'}   = "positivo";
+    $t                   = $obj->real("124.345");
+    is( $t, uc "positivo ciento veinticuatro CON trescientos cuarenta y cinco milesimos",
+        "t_real_2" );
+    $obj->{'MAYUSCULAS'} = 0;
+    $t = $obj->real("-0.124345e3");
+    is( $t, "menos ciento veinticuatro CON trescientos cuarenta y cinco milesimos", "t_real_2" );
+    $t = $obj->real("-124345e-3");
+    is( $t, "menos ciento veinticuatro CON trescientos cuarenta y cinco milesimos", "t_real_2" );
+    $t = $obj->real("-0.224345e3");
+    is( $t, "menos doscientos veinticuatro CON trescientos cuarenta y cinco milesimos", "t_real_2" );
+    $t = $obj->real("-224345e-3");
+    is( $t, "menos doscientos veinticuatro CON trescientos cuarenta y cinco milesimos", "t_real_2" );
 
     $obj = $obj->new( GENERO => 'o' );
     $obj->{'FORMATO'} = "CON %2d";

Modified: branches/upstream/liblingua-es-numeros-perl/current/t/t04_ordinals.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/t/t04_ordinals.t?rev=50410&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/t/t04_ordinals.t (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/t/t04_ordinals.t Wed Jan  6 23:20:14 2010
@@ -69,13 +69,13 @@
     }
 
     eval { $obj->ordinal( 1 x 126 ) };
-    ok( !$@, "Ordinal en rango" );
+    ok( !$@, "Ordinal in range" );
 
     eval { $obj->ordinal( 1 x 127 ) };
-    ok( $@ =~ /^Fuera de rango/, "Ordinal fuera de rango" );
+    ok( $@ =~ /^Fuera de rango/, "Ordinal out of range" );
 
     eval { $obj->ordinal(-1) };
-    ok( $@ =~ /^Ordinal negativo/, "Ordinal negativo" );
+    ok( $@ =~ /^Ordinal negativo/, "Negative ordinal" );
 
     # FIXME: some way to check carp ?
     eval { $obj->ordinal(-0) };




More information about the Pkg-perl-cvs-commits mailing list