Analizo
view release on metacpan or search on metacpan
lib/Analizo/Model.pm view on Meta::CPAN
$graph->set_vertex_attribute($caller, 'group', $self->_function_to_module($caller));
$graph->set_vertex_attribute($callee, 'group', $self->_function_to_module($callee));
}
}
}
return $graph;
}
sub _file_to_module {
my ($filename) = @_;
$filename =~ s/\.r\d+\.expand$//;
return basename($filename);
}
sub _function_to_module {
my ($self, $function) = @_;
return undef if !exists($self->members->{$function});
return _file_to_module($self->members->{$function});
}
sub _include_caller {
t/Analizo/Model.t view on Meta::CPAN
$model->add_call('function1', 'function2');
is(
$model->callgraph(include_externals => 1),
'function1-function2',
'must be able to omit a called function'
);
}
sub groupping_by_module : Tests {
my $model = Analizo::Model->new;
$model->declare_function('cluster1.c.r1874.expand', 'function1');
$model->declare_function('cluster2.c.r9873.expand', 'function2');
$model->declare_function('cluster2.c.r9873.expand', 'function3');
$model->add_call('function1', 'function2');
$model->add_call('function1', 'function3');
is(
$model->callgraph(group_by_module => 1),
'cluster1.c-cluster2.c',
'must list correctly a single dependency arrow between two modules'
);
$model->add_call('function1', 'function4');
$model->declare_function('cluster3.c.r8773.expand', 'function4');
is(
$model->callgraph(group_by_module => 1),
'cluster1.c-cluster2.c,cluster1.c-cluster3.c',
'must list arrow targets in lexicographic order'
);
$model->add_call('function5', 'function1');
$model->declare_function('cluster0.c.r7412.expand', 'function5');
is(
$model->callgraph(group_by_module => 1),
'cluster0.c-cluster1.c,cluster1.c-cluster2.c,cluster1.c-cluster3.c',
'must list arrow sources in in lexicographic order'
);
}
sub use_of_variables : Tests {
my $model = Analizo::Model->new;
$model->declare_function('module1.c.r1234.expand', 'function1');
$model->declare_variable('module2.c', 'myvariable');
$model->add_variable_use('function1', 'myvariable');
is(
$model->callgraph,
'function1-myvariable',
'must output declared variables'
);
# test grouping by module
is(
$model->callgraph(group_by_module => 1),
t/samples/mlpack-3.0.0/parse_command_line.hpp view on Meta::CPAN
// loop because there might be another duplicate later on in the
// vector.
bpo.options.erase(bpo.options.begin() + j);
--j; // Fix the index.
}
else
{
// If one or both has a value, produce an error and politely
// terminate. We pull the name from the original_tokens, rather
// than from the string_key, because the string_key is the parameter
// after aliases have been expanded.
Log::Fatal << "\"" << bpo.options[j].original_tokens[0] << "\" is "
<< "defined multiple times." << std::endl;
}
}
}
}
store(bpo, vmap);
}
catch (std::exception& ex)
t/samples/sample_basic/c/Makefile view on Meta::CPAN
CFLAGS = -dr
OBJECTS = module1.o module2.o module3.o
all: program
program: $(OBJECTS)
gcc -o $@ $(OBJECTS)
clean:
rm -f *.o *.expand program tags
( run in 0.567 second using v1.01-cache-2.11-cpan-5b529ec07f3 )