Billy Patton <[EMAIL PROTECTED]> writes:
>something strange happening with testing using Test::More
>I have a t directory with my .t files
>
>Not even sure how to ask about problem?
>So forgive if problem is sketchy.  If you don't use Test::More you will
>probably not be able to help.
>
>I can run
>perl -Mblib t/NodeMalloc.t and everything is fine
>
>when I run make test and it runs
>PERL_DL_NONLAZY=1 /data/cdmg/perl/5.8.0-32/SunOS/bin/perl "-MExtUtils::Command::MM" 
>"-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

That is usually because you have written something to stdout which isn't
a result report.

Stdout should have nothing but things that match one of these
1\.\.\d+$
#.*$
(not )ok \d+$

And the ok numbers must be in strictly increasing order.

That said your tests are using @_ and %_ is stange ways
would it not be better to use norma vars like @array and 
%hash rather than magical perl system variables?

@_ in particular is going to change under you...

(I don't think %_ means anything but is living 
a magical *_ glob ...)


>
>
>I get:
>t/NodeLayer.......ok
>t/NodeMalloc......ok 92/94Confused test output: test 92 answered after test 92
>t/NodeMalloc......ok 93/94Confused test output: test 93 answered after test 93
>t/NodeMalloc......FAILED test 91
>        Failed 1/94 tests, 98.94% okay
>
>Would seem to be that I have a missing '/" somewhere.  I use gvim and it is color 
>syntax'd
>I see no problems.
>
>
>Here is snippett of xs code:
>    case lCLF:
>        if (items NE 5)
>        {
>          lERROR("Node::New : CLF needs layer, width and pointer to list of points.");
>          goto END;
>        }
>        if (SvTYPE(ST(2)) NE SVt_IV)
>        {
>          lERROR("Node::New : CLF : Arg 2 must be layer integer!");
>          goto END;
>        }
>        if (SvTYPE(ST(3)) NE SVt_IV)
>        {
>          lERROR("Node::New : CLF : Arg 3 must be width integer!");
>          goto END;
>        }
>        if (SvTYPE(ST(4)) NE SVt_RV)
>        {
>          lERROR("Node::New : CLF :arg 4 must be a reference!");
>          goto END;
>        }
>        if (SvTYPE(SvRV(ST(4))) NE SVt_PVAV)
>        {
>          lERROR("Node::New : CLF :arg 4 must be reference to an array!");
>          goto END;
>        }
>        av    = (AV*) SvRV(ST(4));
>        npts  = av_len(av) / 2;
>        for (i = 0,npts = 0; i < av_len(av); i++,npts++)
>        {
>          pts[npts].x = SvIV(*av_fetch(av,i,0));
>          i++;
>          pts[npts].y = SvIV(*av_fetch(av,i,0));
>        }
>        retp   = NodeMalloc(ltype
>                            ,SvIV(ST(2))
>                            ,SvIV(ST(3))
>                            ,npts,pts);
>        break;
>
>
>Here is my .t:  comments below
>
>use Data::Dumper;
>use Test::More tests => 94 ;
>use Laff;
># failure     ok(0);
># successful  ok(1);
>
># a list to be used multiple times
>@pts = qw ( 0 0 0 10 10 10 10 0 0 0);
>
>########################################################################################
>##
>## build main tag types
>##
>########################################################################################
>ok($np = Laff::Node->New                            , 'malloc empty node');
>ok($np->Type == lNOOP                               , 'confirm type is lNOOP');
>ok(! Laff::Node->New(11111)                         , 'fails does know type 11111');
>ok($np = Laff::Node->New(lBOUNDARY)                 , 'create BOUNDARY node');
>ok($np->Type == lBOUNDARY                           , 'confirm node is BOUNDARY');
>ok($np = Laff::Node->New(lDETAIL)                   , 'create lDETAIL  node');
>ok($np->Type == lDETAIL                             , 'confirm node is lDETAIL');
>ok($np = Laff::Node->New(lDIAGNOSTIC)               , 'create lDIAGNOSTIC  node');
>ok($np->Type == lDIAGNOSTIC                         , 'confirm node is lDIAGNOSTIC');
>ok($np = Laff::Node->New(lNAMES)                    , 'create lNAMES  node');
>ok($np->Type == lNAMES                              , 'confirm node is lNAMES');
>ok($np = Laff::Node->New(lPORTS)                    , 'create lPORTS  node');
>ok($np->Type == lPORTS                              , 'confirm node is lPORTS');
>ok($np = Laff::Node->New(lSTRUCT)                   , 'create lSTRUCT  node');
>ok($np->Type == lSTRUCT                             , 'confirm node is lSTRUCT');
>ok($np = Laff::Node->New(lSYMBOLIC)                 , 'create lSYMBOLIC  node');
>ok($np->Type == lSYMBOLIC                           , 'confirm node is lSYMBOLIC');
>
>###################################################################################################
>##
>## build and check arb
>##
>###################################################################################################
>ok(! Laff::Node->New(lARB)                          , 'fail no layer or reference to 
>list');
>ok(! Laff::Node->New(lARB,"fail")                   , 'fail arg 2 must be a int');
>ok(! Laff::Node->New(lARB,111,"fail")               , 'fail arg 3 will not accept 
>string');
>ok(! Laff::Node->New(lARB,111,111)                  , 'fail arg 3 will not accept 
>int');
>ok(! Laff::Node->New(lARB,111,%_)                   , 'fail arg 3 will not accept 
>hash');
>ok(! Laff::Node->New(lARB,111,\%_)                  , 'fail arg 3 will not accept 
>reference to hash');
>ok(! Laff::Node->New(lARB,111,@pts)                 , 'fail arg 3 will not accept 
>list');
>ok($p = Laff::Node->New(lARB,111,[EMAIL PROTECTED])             , 'allocate new arb');
>ok($p->Type == lARB                                 , 'confirm node ia arb');
>ok($p->Layer == 111                                 , 'confirm layer');
>ok(@list = $p->Points                               , 'get points');
>ok(0 == shift @list                                 , 'confirm 0->x == 0');
>ok(0 == shift @list                                 , 'confirm 0->y == 0');
>ok(0 == shift @list                                 , 'confirm 1->x == 0');
>ok(10 == shift @list                                , 'confirm 1->y == 10');
>ok(10 == shift @list                                , 'confirm 2->x == 10');
>ok(10 == shift @list                                , 'confirm 2->y == 10');
>ok(10 == shift @list                                , 'confirm 3->x == 10');
>ok(0 == shift @list                                 , 'confirm 3->y == 0');
>ok(! @list                                          , 'confirm only 4 points');
>
>##################################################################################################
>#
># build and check attr
>#
>##################################################################################################
>ok(! Laff::Node->New(lATTR)             , 'fail no value passed');
>ok(! Laff::Node->New(lATTR,123)         , 'fail will not accept integers');
>ok(! Laff::Node->New(lATTR,[EMAIL PROTECTED])         , 'fail will not accept 
>reference to list');
>ok(! Laff::Node->New(lATTR,\%_)         , 'fail will not accept reference to hash');
>ok(! Laff::Node->New(lATTR,@_)          , 'fail will not accept list');
>ok(! Laff::Node->New(lATTR,%_)          , 'fail will not accept hash');
>ok($np = Laff::Node->New(lATTR,'test')  , 'allocate attr with value test');
>ok($np->Name eq 'TEST'                  , 'confirm value is TEST');
>
>##################################################################################################
>#
># build and check circle
>#
>##################################################################################################
>ok(! Laff::Node->New(lCIRCLE)                 , 'fail CIRCLE needs layer, radius, x 
>and y.');
>ok(! Laff::Node->New(lCIRCLE,"s",1,0,0)       , 'fail arg 2 will not accept string');
>ok(! Laff::Node->New(lCIRCLE, @_,1,0,0)       , 'fail arg 2 will not accept list');
>ok(! Laff::Node->New(lCIRCLE, %_,1,0,0)       , 'fail arg 2 will not accept hash');
>ok(! Laff::Node->New(lCIRCLE,[EMAIL PROTECTED],1,0,0)       , 'fail arg 2 will not 
>accept reference to list');
>ok(! Laff::Node->New(lCIRCLE,\%_,1,0,0)       , 'fail arg 2 will not accept reference 
>to hash');
>ok(! Laff::Node->New(lCIRCLE,1,"s",0,0)       , 'fail arg 3 will not accept string');
>ok(! Laff::Node->New(lCIRCLE,1, @_,0,0)       , 'fail arg 3 will not accept list');
>ok(! Laff::Node->New(lCIRCLE,1, %_,0,0)       , 'fail arg 3 will not accept hash');
>ok(! Laff::Node->New(lCIRCLE,1,[EMAIL PROTECTED],0,0)       , 'fail arg 3 will not 
>accept reference to list');
>ok(! Laff::Node->New(lCIRCLE,1,\%_,0,0)       , 'fail arg 3 will not accept reference 
>to hash');
>ok(! Laff::Node->New(lCIRCLE,1,0,"s",0)       , 'fail arg 4 will not accept string');
>ok(! Laff::Node->New(lCIRCLE,1,0, @_,0)       , 'fail arg 4 will not accept list');
>ok(! Laff::Node->New(lCIRCLE,1,0, %_,0)       , 'fail arg 4 will not accept hash');
>ok(! Laff::Node->New(lCIRCLE,1,0,[EMAIL PROTECTED],0)       , 'fail arg 4 will not 
>accept reference to list');
>ok(! Laff::Node->New(lCIRCLE,1,0,0,\%_)       , 'fail arg 5 will not accept reference 
>to hash');
>ok(! Laff::Node->New(lCIRCLE,1,0,0,"s")       , 'fail arg 5 will not accept string');
>ok(! Laff::Node->New(lCIRCLE,1,0,0, @_)       , 'fail arg 5 will not accept list');
>ok(! Laff::Node->New(lCIRCLE,1,0,0, %_)       , 'fail arg 5 will not accept hash');
>ok(! Laff::Node->New(lCIRCLE,1,0,0,[EMAIL PROTECTED])       , 'fail arg 5 will not 
>accept reference to list');
>ok(! Laff::Node->New(lCIRCLE,1,0,0,\%_)       , 'fail arg 5 will not accept reference 
>to hash');
>ok($np = Laff::Node->New(lCIRCLE,2,20,30,40)  , 'allocate circle node');
>ok($np->Type == lCIRCLE                       , 'confirm node is lCIRCLE');
>ok($np->Layer == 2                            , 'confirm layer is 2');
>ok($np->Radius == 20                          , 'confirm radius is 20');
>ok(@list = $np->Points                        , 'get points');
>ok(2 == scalar(@list)                         , 'confirm 2 points');
>ok(30 == $list[0]                             , 'confirm x is 30');
>ok(40 == $list[1]                             , 'confirm y is 40');
>
>###################################################################################################
>##
>## build and check circle
>##
>###################################################################################################
>ok(! Laff::Node->New(lCLF)                    , 'fail CLF needs layer, width and 
>reference to list');
>ok(! Laff::Node->New(lCLF,"s",3,20)           , 'fail arg 2 will not accept a 
>string');
>ok(! Laff::Node->New(lCLF, @_,3,20)           , 'fail arg 2 will not accept a list');
>ok(! Laff::Node->New(lCLF, %_,3,20)           , 'fail arg 2 will not accept a hash');
>ok(! Laff::Node->New(lCLF,[EMAIL PROTECTED],3,20)           , 'fail arg 2 will not 
>accept a reference to a list');
>ok(! Laff::Node->New(lCLF,\%_,3,20)           , 'fail arg 2 will not accept a 
>reference to a hash');
>
>
>COMMENT ADDED
>if I comment out the previous line I get no errors
>t/NodeMalloc......ok 92/94Confused test output: test 92 answered after test 92
>t/NodeMalloc......ok 93/94Confused test output: test 93 answered after test 93
>which are the checks below.
>END COMMENT
>
>##################################################################################################
>#
># build and check connect
>#
>##################################################################################################
>ok(! Laff::Node->New(lCONNECT)                , 'fail CONNECT needs id number and 
>signal name');
>ok(! Laff::Node->New(lCONNECT,'s',1)          , 'fail arg 2 will not accept string');
>ok(! Laff::Node->New(lCONNECT, @_,1)          , 'fail arg 2 will not accept list');
>ok(! Laff::Node->New(lCONNECT, %_,1)          , 'fail arg 2 will not accept hash');
>ok(! Laff::Node->New(lCONNECT,\%_,1)          , 'fail arg 2 will not accept refernece 
>to hash');
>ok(! Laff::Node->New(lCONNECT,[EMAIL PROTECTED],1)          , 'fail arg 2 will not 
>accept reference to list');
>ok(! Laff::Node->New(lCONNECT,1,1)            , 'fail arg 2 will not accept int');
>ok(! Laff::Node->New(lCONNECT,1, @_)          , 'fail arg 2 will not accept list');
>ok(! Laff::Node->New(lCONNECT,1, %_)          , 'fail arg 2 will not accept hash');
>ok(! Laff::Node->New(lCONNECT,1,\%_)          , 'fail arg 2 will not accept refernece 
>to hash');
>ok(! Laff::Node->New(lCONNECT,1,[EMAIL PROTECTED])          , 'fail arg 2 will not 
>accept reference to list');
>ok($np = Laff::Node->New(lCONNECT,1,'test')   , 'allocate connect node');
>ok($np->Id == 1                               , 'confirm id is 1');
>ok($np->Name eq 'TEST'                        , 'confirm name is test');
>
>
>   ___  _ ____       ___       __  __
>  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___
> / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
>/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
>           /___/
>Texas Instruments ASIC Circuit Design Methodlogy Group
>Dallas, Texas, 214-480-4455,  [EMAIL PROTECTED]

Reply via email to