想起编译perl时的测试集,可以参考一下。 // E-Mail:[email protected] <e-mail%[email protected]> / QQ:28888888 / MSN:[email protected] <msn%[email protected]>
在 2010-8-9 下午3:11,"Qiang (James)" <[email protected]>写道: > On 08/09/2010 09:13 AM, Michael Zeng wrote: >> 比如 检测 大量的 regex 抓取是否 正确 , > > Test::More 里面的 like 就可以。 > > Qiang (James) > >> >> 2010/8/9 Michael Zeng <[email protected] <mailto:[email protected] >> >> >> 对, 就是测试 那个抽取的 是否是 想要 的 >> Test 模块能解决这个问题么 >> 眼睛看比较累 >> >> 2010/8/9 Qiang (James) <[email protected] >> <mailto:[email protected]>> >> >> On 08/09/2010 06:13 AM, Michael Zeng wrote: >> > 最近写个程序,要抽取 几万 到几十万个数据, >> >> 你要测试的是什么?抽取的数据是否正确?何为正确? >> >> 另外,如果数据庞大,测试的时候你不可能把所有数据都测试一遍。选出 >> 几个普通 >> 的,另类的例子作抽查即可。 >> >> Qiang (James) >> >> > 这个怎么校验啊? >> > 用的是 多重hash 链表结构, >> > 写 Test::More , Test::Deep 也不现实啊, 因为自己要先写正确 >> 的 数值,才 >> > 能比较, >> > 数值太多了 , >> > 比如 >> > 原程序: >> > ....... >> > use Storable ; >> > store $info , 'file' ; # store the big reference variable out , >> > ........ >> > 测试程序: test.t >> > use Storable ; >> > my $info = retrieve 'file' ; >> > 这个没法写啊, 数据这么多, 要一个一个看 , >> > my $correct_one = { >> > A -> { >> > B -> C >> > ... >> > } >> > data2 -> >> > data3 -> >> > data4 -> >> > ...... >> > } >> > cmp_deeply( $info , $correct_one , ' both hash equal' ) ; >> > 用Test::More 也是一样的, 要写很多 is, 比如 >> > is ( $info->{data1}->{AAA} , $correct_value1 , " ok1" } >> > is ( $info->{data2}->{AAA} , $correct_value1 , " ok2" } >> > is ( $info->{data3}->{AAA} , $correct_value1 , " ok3" } >> > >> > -- >> > Yours Sincerely >> > Zeng Hong >> > >> >> >> >> -- >> Yours Sincerely >> Zeng Hong >> >> >> >> >> -- >> Yours Sincerely >> Zeng Hong >> > > -- > 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 > 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 > 要取消订阅此网上论坛,请发送电子邮件至 > [email protected]<perlchina%[email protected]> 。 > 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。 > -- 您收到此邮件是因为您订阅了 Google 网上论坛的“PerlChina Mongers 讨论组”论坛。 要向此网上论坛发帖,请发送电子邮件至 [email protected]。 要取消订阅此网上论坛,请发送电子邮件至 [email protected]。 若有更多问题,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问此网上论坛。
