Config-Model
view release on metacpan or search on metacpan
t/multi_warp_value.t view on Meta::CPAN
# -*- cperl -*-
use ExtUtils::testlib;
use Test::More;
use Test::Differences;
use Test::Memory::Cycle;
use Config::Model;
use Config::Model::Tester::Setup qw/init_test/;
use Storable qw/dclone/;
use strict;
use warnings;
my ($model, $trace) = init_test();
my @m1 = qw/A1 B1/;
my @m2 = qw/A2 B2 C2/;
my @m3 = qw/A3 B3/;
my @rules;
foreach my $c1 (@m1) {
foreach my $c2 (@m2) {
foreach my $c3 (@m3) {
push @rules, [ $c1, $c2, $c3 ], { default => "m$c1$c2$c3" };
}
}
}
# minimal set up to get things working
my $model_data = {
name => 'Master',
'element' => [
macro1 => {
type => 'leaf',
value_type => 'enum',
choice => \@m1
},
macro2 => {
type => 'leaf',
value_type => 'enum',
choice => \@m2
},
macro3 => {
type => 'leaf',
value_type => 'enum',
choice => \@m3
},
m1 => {
type => 'leaf',
value_type => 'string',
'warp' => {
follow => [ '- macro1', ' - macro2', '- macro3' ],
rules => \@rules
}
},
'm2' => {
type => 'leaf',
value_type => 'string',
default => 'unsatisfied',
'warp' => {
follow => [ '- macro1', ' - macro2', '- macro3' ],
'rules' => [
[ 'A1', 'A2', 'A3' ] => { default => '3xA' },
[ 'B1', [ 'B2', 'C2' ], 'B3' ] => { default => '3x[BC]' },
]
( run in 0.650 second using v1.01-cache-2.11-cpan-39bf76dae61 )