ckconj

filter: Statementstmt 80.0% 44 / 55 Branchbran 60.0% 18 / 30 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 70.3% 64 / 91 CC 1 SCAR 0.0
CC
1
Cov
72%
BEGIN
1.0
CRAP 1.0
« blib/lib/Lingua/PT/VerbSuffixes.pm ↑ Summary
1 #!/usr/bin/perl -I . -I ../.. -w
2  
3 #
4 # ckonj
5 # Author : Etienne Grossmann
6 # Created On : May 1997
7 # Last Modified On: January 1998
8 # Language : Perl
9 # Status : Use with caution!
10 #
11 # (C) Copyright 1998 Etienne Grossmann
12 #
13  
14 1 ▶use Lingua::PT::Conjugate qw( conjug codify env_is_utf8 verify %verb $vlist $cpat $vpat
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 $wpat $letter );
16 1 import Lingua::PT::Accent_iso_8859_1 qw(iso2asc asc2iso);
17  
18 1 ▶if (env_is_utf8())
Branch: 1 branch
BranchTrueFalseTotal
if (&env_is_utf8()) 0 1 1
19 {
20 0 binmode (STDOUT, ":utf8");
21 }
22  
23 1 ▶if (! %verb)
Branch: 1 branch
BranchTrueFalseTotal
unless (%verb) 0 1 1
24 {
25 0 die "No way of continuing without \%verb ! ";
26 }
27  
28 1 ▶$rfile = "reference" unless $rfile;
Branch: 1 branch
BranchTrueFalseTotal
unless $rfile 1 0 1
29  
30 1 ▶die "file $rfile not found" unless open (VF,"<$rfile");
Branch: 1 branch
BranchTrueFalseTotal
unless open VF, "<$rfile" 0 1 1
31 {
32 1 binmode (VF, ":utf8");
33 1 my @vf = <VF>;
34 1 close VF;
35 1 $rs = join("",@vf);
36 1 $rs =~ s/\#.*\n*//mg;
37 1 $rs =~ s/\-+//mg;
38 1 $rs .= "\ndummy:";
39 }
40  
41 1 $ret_value = 0; # For the moment, nothing failed
42  
43 1 $codified = 0;
44  
45 1 ▶if(defined($ARGV[0]) && -e $ARGV[0]){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $ARGV[0] and -e $ARGV[0]) 0 1 1
Condition33%1/3
defined $ARGV[0] and -e $ARGV[0]
!ll&&!rl&&r
010
MC/DC0%0/2
defined $ARGV[0] and -e $ARGV[0]
defined $ARGV[0] -e $ARGV[0]
Truth table33%1/3
A and B
A= defined $ARGV[0]B= -e $ARGV[0]
ABresult
0X0
100
111
46 0 $rfile = $ARGV[0];
47 0 ▶ codify($vlist) unless $codified == 1;
Branch: 1 branch
BranchTrueFalseTotal
unless $codified == 1 0 0 0
48 0 $codified = 1;
49 0 shift @ARGV;
50 }
51 1 @ARGV= sort @ARGV ;
52 1 $ok_list = "";
53 1 ▶while( $v = shift @ARGV ){
Branch: 1 branch
BranchTrueFalseTotal
if ($v = shift @ARGV) 200 1 201
54 200 ▶ if($v eq "all"){ # Add all known verbs to @ARGV
Branch: 1 branch
BranchTrueFalseTotal
if ($v eq "all") 1 199 200
55 1 ▶ codify($vlist) unless $codified;
Branch: 1 branch
BranchTrueFalseTotal
unless $codified 1 0 1
56 1 push( @ARGV, keys(%verb) );
57 # push( @ARGV, keys(%{$verb->{defectivos}}) );
58 1 @ARGV=sort @ARGV;
59 1 next;
60 }
61 199 ▶ if( $v =~ /^defectivos[123]?$/){
Branch: 1 branch
BranchTrueFalseTotal
if ($v =~ /^defectivos[123]?$/) 4 195 199
62 4 next;
63 }
64 195 ▶ if($v){
Branch: 1 branch
BranchTrueFalseTotal
if ($v) { } 195 0 195
65 195 ▶ $v=asc2iso($v) if $v=~/[\"\'\^\\\~]/ ;
Branch: 1 branch
BranchTrueFalseTotal
if $v =~ /[\"\'\^\\\~]/ 0 195 195
66 195 $x = $v;
67 # print "$v ";
68 195 $x =~ s/\\/\./g;
69 # print "x is >$x<\nrs is >$rs<\n";
70 195 $rs =~ / \b( $x \s* : [^:]*) (\b$wpat+ \s* :) /mx ;#'"
71 # print "x $x, $1, $2\n";
72 195 $w = $1;
73 # print "Found Reference >>$w<<\n";
74 } else {
75 0 print "empty <$v>\n";
76 0 $w="";
77 0 next;
78 }
79 195 ▶ if( !$w ){
Branch: 1 branch
BranchTrueFalseTotal
unless ($w) 115 80 195
80 115 $absent_list .= "$v ";
81 115 next;
82 }
83 80 $res = Lingua::PT::Conjugate::verify($w);
84 80 ▶ if($res =~ /^OK/){
Branch: 1 branch
BranchTrueFalseTotal
if ($res =~ /^OK/) { } 80 0 80
85 80 $ok_list .= "$v ";
86 } else {
87 0 $ret_value = 1;
88 0 print "Complaint :\n$res\n";
89 }
90 }
91 1 print "THESE VERBS ARE OK >>$ok_list<<\n";
92 1 ▶print "NOT IN REFERENCE FILE (no error found) >>$absent_list<<\n"
Branch: 1 branch
BranchTrueFalseTotal
if $absent_list 1 0 1
93 if $absent_list;
94  
95 # use Data::Dumper;
96 # $Data::Dumper::Useqq=1;
97 # $Data::Dumper::Terse=1;
98  
99 # print "Abolir:\n" ;
100 # print Dumper( $verb{abolir} ) ;
101 # print conjug(abolir) ;
102 # print "Def",$verb{defectivos}->{abolir},"\n" ;
103 # print Dumper( $verb{defectivos} );
104 1 exit($ret_value)
« blib/lib/Lingua/PT/VerbSuffixes.pm ↑ Summary