Maybe this minimal demo gets you started?

It's implementing a basic test function "rank" which tests eq and does a linear quality ranking from 1 to 0 against the provided list.

The output includes a field "quality:"

You are free to extend this in multiple ways, like

As already said I'd use TAP::Parser to find the quality fields.

use strict; use warnings; use Test::More; TODO: { local $TODO = "STRINGIFICATION"; rank( 'a-b' => ['a+(-b)', 'a+-b', 'a-b'], "to pass" ); rank( 'a--b' => ['a+(-b)', 'a+-b', 'a-b'], "to fail" ); } sub rank { my ($got, $a_exps, $name) = @_; local $Test::Builder::Level = $Test::Builder::Level + 1; my @exps = @$a_exps; my $pos = 0; my %rank = map { $_ => 1- ($pos++ / @exps) } @exps; my $quality = $rank{$got}; if($quality){ pass($name); diag( sprintf "%12s: %.2f", "quality", $quality ); } else { fail($name); diag( sprintf "%12s: %s", "got","'$got'" ); diag( sprintf "%12s: %s", "expected", join ", ", map {"'$_'"} +@exps ); diag( sprintf "%12s: %.2f", "quality", 0 ); } } done_testing; exit; __END__

ok 1 - to pass # TODO STRINGIFICATION # quality: 0.33 not ok 2 - to fail # TODO STRINGIFICATION # Failed (TODO) test 'to fail' # at /home/lanx/perl/pm/test_rank.pl line 10. # got: 'a--b' # expected: 'a+(-b)', 'a+-b', 'a-b' # quality: 0.00 1..2

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery


In reply to Re^3: Testing: shades of grey by LanX
in thread Testing: shades of grey by hv

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.