From bb65d3e7ef906e0f3df9e71b9417756fb564cc01 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 5 Oct 2007 12:12:10 +0000 Subject: [PATCH] New --- releases/Net-Z3950-PQF-0.04.tar.gz | Bin 0 -> 8047 bytes t/3-simpleserver.t | 76 ++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 releases/Net-Z3950-PQF-0.04.tar.gz create mode 100644 t/3-simpleserver.t diff --git a/releases/Net-Z3950-PQF-0.04.tar.gz b/releases/Net-Z3950-PQF-0.04.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fc01f7fce85ee072214606acedf8c18dcf167c1d GIT binary patch literal 8047 zcmV-#ACTZ5iwFpLDh5Xa15RahEm|`^y0E+s4uPO8km3 z9P4RxL{gHbiC;Y+u_RG}0F6TutE#{Kota&L00~lZ>c~wiHnm9X z%NL`SRJn;m^i z|DvJmTlfb$Up&Dl3PRHd_+nyTiFI%fwf{js$IJRZJLtVRI{3u;@3z~k^sjfCZPdTs zZFKdfzSTwjH@j#q(0JDW@BVptXc-_iUbzOn)`VsQZ9s3<^)1l1483c#yFi17gWD;* z)HDrE#xU4s3P;MjfN^k*>jy=&VN0hll~{XqCI^n5@(D4+UbXy3y3 zkwCb&o-&CLnIHEePl-vQq0b;9@ovRUJMc zHCqHVATBh8f&APc6V42xKv>WhW81YL93$m{aFIE07?UxlQ^y{dq3yW=F=HXJW;%f< zQN?X2+`zsjS~qq$hEN1yb!_@bC7{8Md~*^&5Dms)2HeHZy}xM#Z!$qzRmXM(3>;gy zVFhO9KdSP34aIusq9r;G_pDV@9~7tuwroX$IF^ZLMUH?FN6bA8J;(8GP!@)!6{f;> z;K;l}**ciV4U$q4+ zD5-KJLTvnU?78B_dnCW_O=rG68ix$@osAM7h)h4J4uA6P5G4%#861((U6?Zm)%}Vr za1WIxZY?u3Ybej%H0ARCCL1o{9TF70K``h|&ua_zh+l`kK*f8*@W%ATHq5*T255D@ zuxv6kG(40Jb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Y+=BQYoG>{}3TS}rqdfc(d?d5y%F5+6X@IH=-O!m+LSyKF73CtU zc1%W)pvfHvRZPi-kiyvUJ6iIm5V-3qky*KB1By|wf^N$b(1+&9)V=x1?;1Ws}Kfe?d%gJp+7 z_b0>TD$W*&q>r8`cgF)1baMXynQ?iRSR@NUAwCDm4_x*o$~dQ7<=P!D(-{btir~G; z5S8x;_=L^5ne4Sk({OQqg7bTdsB2|qF+$qd0;h#h(;_-$8EzM(CCBue+JwV0I?H$I zp>g(K?x3krq2xpf0Ro)>C11W9f%pIHvPcXMice~1wL$Luc|ky*_ArF+-+&z-)cBbQ0LiY!s-!o7!(lAk!TwsrSkwW zgC^Q}UY6-eM*bX>YXjDVtQD((IF1G@jUN&p4rYO}1L2&JWZ(8yx}B#qqUn_O6!uVa zpWH}pP&Y_pp$KWV2?ME$?t$!bz6wQh9;NIfRNHW1dg8Xeq!Eaw05k24_BM9h(xB&N zC)Q>U)^A%jtiWwQL2Wl7jpj1kBZNs~ak87aDar3_)%huFAtX234H zz#e)AjIAY!G^d5tc7x|hG-cZX`hP#09PI(|e_w95ZXP&!Itm5EZzL?902w|k)b#md zZ?&f*6G~6rS(a~^6qGw(_6TXSM zz4ceMrLVMUA+#tZ9;3GL!In4y3V6ZE67jhWMB-y(Q5J07INgquen!tUDz6Efouy3zIyQ+S+Q~P8!2G~0L^RtkwZ;vL67JmQ{M8JCB(;7 z;e+*hDvc2PbSe?|Y@srJ*NH|7XRR9|c!l&89Wv0YKys$ue1i=3qB7ip7=8vnT`PPk z4m1f`{O><0X7f1<*;ZkS#QX9CJ{##_1tmv#780$nybE~~_nZ>O~Bm?SiQ2x@%l?f&#^s;1+t_Xtc)W^Wx>< ztMS3!!Tz`b 52; +BEGIN { use_ok('Net::Z3950::PQF') }; + +my $parser = new Net::Z3950::PQF(); +ok(defined $parser, "created parser"); +my $top = $parser->parse( +'@and @or @set 123 @attr 1=1023 frog @attr 2=3 @attr zthes 1=magic bar'); + +my $ss = $top->toSimpleServer(); +check_node($ss, "top node", "Net::Z3950::RPN::And", "an AND node"); +is(@$ss, 2, "top has two subtrees"); + +my $sub = $ss->[0]; +check_node($sub, "first subtree", "Net::Z3950::RPN::Or", "an OR node"); +is(@$sub, 2, "first subnode has two subtrees"); + +my $subsub = $sub->[0]; +check_node($subsub, "first subsubtree", "Net::Z3950::RPN::RSID", "an RSID"); +is($subsub->{id}, 123, "RSID value"); +check_attributes($subsub->{attributes}, "first subsubtree", 0); + +$subsub = $sub->[1]; +check_node($subsub, "second subsubtree", "Net::Z3950::RPN::Term", "a Term"); +is($subsub->{term}, "frog", "term value"); +check_attributes($subsub->{attributes}, "second subsubtree", 1); +check_attribute($subsub->{attributes}->[0], + "second subsubtree, only attribute", "bib-1", 1 => 1023); + +$sub = $ss->[1]; +check_node($sub, "second subtree", "Net::Z3950::RPN::Term", "a Term"); +is($sub->{term}, "bar", "term value"); +check_attributes($sub->{attributes}, "second subtree", 2); +check_attribute($sub->{attributes}->[0], + "second subtree, second attribute", "bib-1", 2 => 3); +check_attribute($sub->{attributes}->[1], + "second subtree, first attribute", "zthes", 1 => "magic"); + +#use YAML; print Dump($ss); + + +sub check_node { + my($node, $caption, $class, $description) = @_; + + ok(defined $node, "$caption is defined"); + ok(ref $node, "$caption is a reference"); + ok($node->isa($class), "$caption is $description"); +} + + +sub check_attributes { + my($attrs, $caption, $count) = @_; + + ok(defined $attrs, "$caption has attributes"); + ok(ref $attrs, "$caption attributes are a reference"); + ok($attrs->isa("Net::Z3950::RPN::Attributes"), "$caption attributes type"); + is(@{ $attrs }, $count, "$caption attribute count = $count"); +} + + +sub check_attribute { + my($attr, $caption, $set, $type, $value) = @_; + + ok(defined $attr, "$caption is defined"); + ok(ref $attr, "$caption is a reference"); + ok($attr->isa("Net::Z3950::RPN::Attribute"), "$caption type"); + is($attr->{attributeSet}, $set, "$caption attribute set"); + is($attr->{attributeType}, $type, "$caption attribute set"); + is($attr->{attributeValue}, $value, "$caption attribute set"); +} -- 1.7.10.4