use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 32;
use Sub::Nary;
'cumulate ref, 1, frac');
is_deeply(cumulate({ 1 => 0.5, 2 => 0.5 }, 2, 0.5), { 1 => 0.75, 2 => 0.75 },
'cumulate ref, 1, frac');
+
+*combine = *Sub::Nary::combine{CODE};
+
+is_deeply(combine(undef), undef, 'combine undef');
+is_deeply(combine({}), {}, 'combine empty-ref');
+is_deeply(combine({}, {}), {}, 'combine empty-ref, empty-ref');
+is_deeply(combine(1), { 1 => 1 }, 'combine const');
+is_deeply(combine(1, 2), { 3 => 1 }, 'combine const, const');
+is_deeply(combine(1, 'list'), { 'list' => 1 }, 'combine const, list');
+is_deeply(combine(1,{'list'=>1}), { 'list' => 1 }, 'combine const, list');
+is_deeply(combine(1, { 1 => 0.5, 2 => 0.5 }), { 2 => 0.5, 3 => 0.5 },
+ 'combine const, hashref');
+is_deeply(combine(1, { 1 => 0.5, 'list' => 0.5 }), { 2 => 0.5, 'list' => 0.5 },
+ 'combine const, hashref with list');
+my $x = { 1 => 0.5, 2 => 0.5 };
+is_deeply(combine($x, $x), { 2 => 0.25, 3 => 0.5, 4 => 0.25 },
+ 'combine hashref, hashref');
+is_deeply(combine($x, 'list', $x), { list => 1 },
+ 'combine hashref, list, hashref');
+$x = { 1 => 0.5, list => 0.5 };
+is_deeply(combine($x, $x), { 2 => 0.25, list => 0.75 },
+ 'combine hashref with list, hashref with list');
+