Created
May 19, 2015 01:16
-
-
Save notbenh/42cd79ea09f384f249aa to your computer and use it in GitHub Desktop.
How to group possible bundles when given only part_ids
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Test::More; | |
my $bundle = { | |
A => [qw{box widget1}], | |
B => [qw{box widget1 widget2}], | |
C => [qw{box widget1 widget3}], | |
D => [qw{box widget1 widget2 widget3}] | |
}; | |
sub group_ids{ | |
my $return = {}; | |
# ??? | |
return $return; | |
} | |
is_deeply group_ids(@{ $bundle->{A} }), | |
{ A=>[[qw{box widget1}]] }, | |
q{A only}; | |
is_deeply group_ids(@{ $bundle->{A}}, | |
@{ $bundle->{D}}, | |
@{ $bundle->{D}}, | |
qw{ widget1 widget1}, | |
), | |
{ A => [[qw{box widget1}]], | |
D => [ [qw{box widget1 widget2 widget3}], | |
[qw{box widget1 widget2 widget3}], | |
], | |
other => [['widget1'],['widget1']] | |
}, | |
q{A,D,D, and two widget1s}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment