Acme-Affinity
view release on metacpan or search on metacpan
eg/permutations view on Meta::CPAN
while ( my $v = $iter->next ) {
$n++;
my $affinity = Acme::Affinity->new(
questions => $questions,
importance => $importance,
me => $v->[0],
you => $v->[1],
);
# print $n, '. ', $affinity->score, "\n";
$scores{ $affinity->score }++;
}
$n = 0;
for my $score ( sort { $a <=> $b } keys %scores ) {
print ++$n, '. ', $score, ' => ', $scores{$score}, "\n";
}
sub get_responses {
my ( $question, $importance ) = @_;
my @responses;
for my $v ( values %$question ) {
my $iter = variations_with_repetition( $v, 2 );
my @answer = ();
my $tc = Term::Choose->new({
prompt => "$i. $question->{q}",
clear_screen => 1,
});
my $choice = $tc->choose($question->{a});
push @answer, $choice;
print "\n\n\n";
$tc = Term::Choose->new({ prompt => 'You want:' });
$choice = $tc->choose($question->{a});
push @answer, $choice;
print "\n\n\n";
$tc = Term::Choose->new({ prompt => 'How important is this to you?' });
$choice = $tc->choose(\@importance);
push @answer, $choice;
$answers{ $question->{i} } = \@answer;
}
Term::Clear::clear();
# Sorted me answers
my $me = [ map { $answers{$_} } sort { $a <=> $b } keys %answers ];
$affinity = Acme::Affinity->new(
questions => [ map { { $_->{q} => $_->{a} } } @$questions ],
me => $me,
you => $you,
);
print 'Score: ', $affinity->score, "\n";
t/01-methods.t view on Meta::CPAN
me => $me,
you => $you,
];
is_deeply $affinity->questions, $questions, 'questions';
is_deeply $affinity->importance, $importance, 'importance';
is_deeply $affinity->me, $me, 'me';
is_deeply $affinity->you, $you, 'you';
my $score = $affinity->score;
is sprintf( '%.2f', $score ), '94.41', 'score';
$me = [
[ 'very organized', 'very organized', 'very important' ],
[ 'no', 'no', 'a little important' ],
];
$you = [
[ 'very organized', 'very organized', 'very important' ],
[ 'no', 'no', 'very important' ],
];
t/author-eol.t view on Meta::CPAN
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::EOL 0.19
use Test::More 0.88;
t/author-no-tabs.t view on Meta::CPAN
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use strict;
use warnings;
# this test was generated with Dist::Zilla::Plugin::Test::NoTabs 0.15
use Test::More 0.88;
t/author-pod-coverage.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
use Test::Pod::Coverage 1.08;
use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
t/author-pod-spell.t view on Meta::CPAN
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use strict;
use warnings;
use Test::More;
# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005
use Test::Spelling 0.12;
t/author-pod-syntax.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use strict; use warnings;
use Test::More;
use Test::Pod 1.41;
all_pod_files_ok();
t/author-synopsis.t view on Meta::CPAN
#!perl
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use Test::Synopsis;
all_synopsis_ok();
( run in 0.715 second using v1.01-cache-2.11-cpan-de7293f3b23 )