⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 2 页
字号:
.\" Automatically generated by Pod::Man 2.16 (Pod::Simple 3.05).\".\" Standard preamble:.\" ========================================================================.de Sh \" Subsection heading.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Vb \" Begin verbatim text.ft CW.nf.ne \\$1...de Ve \" End verbatim text.ft R.fi...\" Set up some character translations and predefined strings.  \*(-- will.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left.\" double quote, and \*(R" will give a right double quote.  \*(C+ will.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,.\" nothing in troff, for use with C<>..tr \(*W-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'.ie n \{\.    ds -- \(*W-.    ds PI pi.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch.    ds L" "".    ds R" "".    ds C` "".    ds C' ""'br\}.el\{\.    ds -- \|\(em\|.    ds PI \(*p.    ds L" ``.    ds R" '''br\}.\".\" Escape single quotes in literal strings from groff's Unicode transform..ie \n(.g .ds Aq \(aq.el       .ds Aq '.\".\" If the F register is turned on, we'll generate index entries on stderr for.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index.\" entries marked with X<> in POD.  Of course, you'll have to process the.\" output yourself in some meaningful fashion..ie \nF \{\.    de IX.    tm Index:\\$1\t\\n%\t"\\$2"...    nr % 0.    rr F.\}.el \{\.    de IX...\}.\".\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2)..\" Fear.  Run.  Save yourself.  No user-serviceable parts..    \" fudge factors for nroff and troff.if n \{\.    ds #H 0.    ds #V .8m.    ds #F .3m.    ds #[ \f1.    ds #] \fP.\}.if t \{\.    ds #H ((1u-(\\\\n(.fu%2u))*.13m).    ds #V .6m.    ds #F 0.    ds #[ \&.    ds #] \&.\}.    \" simple accents for nroff and troff.if n \{\.    ds ' \&.    ds ` \&.    ds ^ \&.    ds , \&.    ds ~ ~.    ds /.\}.if t \{\.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u".    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'.\}.    \" troff and (daisy-wheel) nroff accents.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'.ds 8 \h'\*(#H'\(*b\h'-\*(#H'.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#].ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#].ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#].ds ae a\h'-(\w'a'u*4/10)'e.ds Ae A\h'-(\w'A'u*4/10)'E.    \" corrections for vroff.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'.    \" for low resolution devices (crt and lpr).if \n(.H>23 .if \n(.V>19 \\{\.    ds : e.    ds 8 ss.    ds o a.    ds d- d\h'-1'\(ga.    ds D- D\h'-1'\(hy.    ds th \o'bp'.    ds Th \o'LP'.    ds ae ae.    ds Ae AE.\}.rm #[ #] #H #V #F C.\" ========================================================================.\".IX Title "Test 3".TH Test 3 "2007-12-18" "perl v5.10.0" "Perl Programmers Reference Guide".\" For nroff, turn off justification.  Always turn off hyphenation; it makes.\" way too many mistakes in technical documents..if n .ad l.nh.SH "NAME"Test \- provides a simple framework for writing test scripts.SH "SYNOPSIS".IX Header "SYNOPSIS".Vb 2\&  use strict;\&  use Test;\&\&  # use a BEGIN block so we print our plan before MyModule is loaded\&  BEGIN { plan tests => 14, todo => [3,4] }\&\&  # load your module...\&  use MyModule;\&\&  # Helpful notes.  All note\-lines must start with a "#".\&  print "# I\*(Aqm testing MyModule version $MyModule::VERSION\en";\&\&  ok(0); # failure\&  ok(1); # success\&\&  ok(0); # ok, expected failure (see todo list, above)\&  ok(1); # surprise success!\&\&  ok(0,1);             # failure: \*(Aq0\*(Aq ne \*(Aq1\*(Aq\&  ok(\*(Aqbroke\*(Aq,\*(Aqfixed\*(Aq); # failure: \*(Aqbroke\*(Aq ne \*(Aqfixed\*(Aq\&  ok(\*(Aqfixed\*(Aq,\*(Aqfixed\*(Aq); # success: \*(Aqfixed\*(Aq eq \*(Aqfixed\*(Aq\&  ok(\*(Aqfixed\*(Aq,qr/x/);   # success: \*(Aqfixed\*(Aq =~ qr/x/\&\&  ok(sub { 1+1 }, 2);  # success: \*(Aq2\*(Aq eq \*(Aq2\*(Aq\&  ok(sub { 1+1 }, 3);  # failure: \*(Aq2\*(Aq ne \*(Aq3\*(Aq\&\&  my @list = (0,0);\&  ok @list, 3, "\e@list=".join(\*(Aq,\*(Aq,@list);      #extra notes\&  ok \*(Aqsegmentation fault\*(Aq, \*(Aq/(?i)success/\*(Aq;    #regex match\&\&  skip(\&    $^O =~ m/MSWin/ ? "Skip if MSWin" : 0,  # whether to skip\&    $foo, $bar  # arguments just like for ok(...)\&  );\&  skip(\&    $^O =~ m/MSWin/ ? 0 : "Skip unless MSWin",  # whether to skip\&    $foo, $bar  # arguments just like for ok(...)\&  );.Ve.SH "DESCRIPTION".IX Header "DESCRIPTION"This module simplifies the task of writing test files for Perl modules,such that their output is in the format thatTest::Harness expects to see..SH "QUICK START GUIDE".IX Header "QUICK START GUIDE"To write a test for your new (and probably not even done) module, createa new file called \fIt/test.t\fR (in a new \fIt\fR directory). If you havemultiple test files, to test the \*(L"foo\*(R", \*(L"bar\*(R", and \*(L"baz\*(R" feature sets,then feel free to call your files \fIt/foo.t\fR, \fIt/bar.t\fR, and\&\fIt/baz.t\fR.Sh "Functions".IX Subsection "Functions"This module defines three public functions, \f(CW\*(C`plan(...)\*(C'\fR, \f(CW\*(C`ok(...)\*(C'\fR,and \f(CW\*(C`skip(...)\*(C'\fR.  By default, all three are exported bythe \f(CW\*(C`use Test;\*(C'\fR statement..ie n .IP """plan(...)""" 4.el .IP "\f(CWplan(...)\fR" 4.IX Item "plan(...)".Vb 1\&     BEGIN { plan %theplan; }.Ve.SpThis should be the first thing you call in your test script.  Itdeclares your testing plan, how many there will be, if any of themshould be allowed to fail, and so on..SpTypical usage is just:.Sp.Vb 2\&     use Test;\&     BEGIN { plan tests => 23 }.Ve.SpThese are the things that you can put in the parameters to plan:.RS 4.ie n .IP """tests => \f(CInumber\f(CW""" 4.el .IP "\f(CWtests => \f(CInumber\f(CW\fR" 4.IX Item "tests => number"The number of tests in your script.This means all \fIok()\fR and \fIskip()\fR calls..ie n .IP """todo => [\f(CI1,5,14\f(CW]""" 4.el .IP "\f(CWtodo => [\f(CI1,5,14\f(CW]\fR" 4.IX Item "todo => [1,5,14]"A reference to a list of tests which are allowed to fail.See \*(L"\s-1TODO\s0 \s-1TESTS\s0\*(R"..ie n .IP """onfail => sub { ... }""" 4.el .IP "\f(CWonfail => sub { ... }\fR" 4.IX Item "onfail => sub { ... }".PD 0.ie n .IP """onfail => \e&some_sub""" 4.el .IP "\f(CWonfail => \e&some_sub\fR" 4.IX Item "onfail => &some_sub".PDA subroutine reference to be run at the end of the test script, ifany of the tests fail.  See \*(L"\s-1ONFAIL\s0\*(R"..RE.RS 4.SpYou must call \f(CW\*(C`plan(...)\*(C'\fR once and only once.  You should call itin a \f(CW\*(C`BEGIN {...}\*(C'\fR block, like so:.Sp.Vb 1\&     BEGIN { plan tests => 23 }.Ve.RE.ie n .IP """ok(...)""" 4.el .IP "\f(CWok(...)\fR" 4.IX Item "ok(...)".Vb 3\&  ok(1 + 1 == 2);\&  ok($have, $expect);\&  ok($have, $expect, $diagnostics);.Ve.SpThis function is the reason for \f(CW\*(C`Test\*(C'\fR's existence.  It'sthe basic function thathandles printing "\f(CW\*(C`ok\*(C'\fR\*(L" or \*(R"\f(CW\*(C`not ok\*(C'\fR", along with thecurrent test number.  (That's what \f(CW\*(C`Test::Harness\*(C'\fR wants to see.).SpIn its most basic usage, \f(CW\*(C`ok(...)\*(C'\fR simply takes a single scalarexpression.  If its value is true, the test passes; if false,the test fails.  Examples:.Sp.Vb 1\&    # Examples of ok(scalar)\&\&    ok( 1 + 1 == 2 );           # ok if 1 + 1 == 2\&    ok( $foo =~ /bar/ );        # ok if $foo contains \*(Aqbar\*(Aq\&    ok( baz($x + $y) eq \*(AqArmondo\*(Aq );    # ok if baz($x + $y) returns\&                                        # \*(AqArmondo\*(Aq\&    ok( @a == @b );             # ok if @a and @b are the same length.Ve.SpThe expression is evaluated in scalar context.  So the following willwork:.Sp.Vb 3\&    ok( @stuff );                       # ok if @stuff has any elements\&    ok( !grep !defined $_, @stuff );    # ok if everything in @stuff is\&                                        # defined..Ve.SpA special case is if the expression is a subroutine reference (in either\&\f(CW\*(C`sub {...}\*(C'\fR syntax or \f(CW\*(C`\e&foo\*(C'\fR syntax).  Inthat case, it is executed and its value (true or false) determines ifthe test passes or fails.  For example,.Sp.Vb 5\&    ok( sub {   # See whether sleep works at least passably\&      my $start_time = time;\&      sleep 5;\&      time() \- $start_time  >= 4\&    });.Ve.SpIn its two-argument form, \f(CW\*(C`ok(\f(CIarg1\f(CW, \f(CIarg2\f(CW)\*(C'\fR compares the twoscalar values to see if they match.  They match if both are undefined,or if \fIarg2\fR is a regex that matches \fIarg1\fR, or if they compare equalwith \f(CW\*(C`eq\*(C'\fR..Sp.Vb 1\&    # Example of ok(scalar, scalar)\&\&    ok( "this", "that" );               # not ok, \*(Aqthis\*(Aq ne \*(Aqthat\*(Aq\&    ok( "", undef );                    # not ok, "" is defined.Ve.SpThe second argument is considered a regex if it is either a regexobject or a string that looks like a regex.  Regex objects areconstructed with the qr// operator in recent versions of perl.  Astring is considered to look like a regex if its first and lastcharacters are \*(L"/\*(R", or if the first character is \*(L"m\*(R"and its second and last characters are both thesame non-alphanumeric non-whitespace character.  These regexp.SpRegex examples:.Sp.Vb 4\&    ok( \*(AqJaffO\*(Aq, \*(Aq/Jaff/\*(Aq );    # ok, \*(AqJaffO\*(Aq =~ /Jaff/\&    ok( \*(AqJaffO\*(Aq, \*(Aqm|Jaff|\*(Aq );   # ok, \*(AqJaffO\*(Aq =~ m|Jaff|\&    ok( \*(AqJaffO\*(Aq, qr/Jaff/ );    # ok, \*(AqJaffO\*(Aq =~ qr/Jaff/;\&    ok( \*(AqJaffO\*(Aq, \*(Aq/(?i)jaff/ ); # ok, \*(AqJaffO\*(Aq =~ /jaff/i;.Ve.SpIf either (or both!) is a subroutine reference, it is run and usedas the value for comparing.  For example:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -