User Tools

Site Tools


spln2016:diario7:diario

This is an old revision of the document!


Aula 11 de Abril de 2016

Maquina Virtual : http://natura.di.uminho.pt/wiki/doku.php?id=spln2016:main user: spln | pw: spln

Apresentações dos trabalhos de grupo

Correr testes perl (tipo de output): output formato TAP {Test Anything Protocol}

#ficheiro de teste com extensão *.t file 00-load.t #comando para executar um teste (-T define o tipo de output) perl -T -Ilib t/00-load.t

#módulo para criação de testes use Test::More;

#Begin é um bloco de código que executa antes de qualquer outro no documento BEGIN {

#numero de testes definidos
plan tests => 4;
use_ok ('Statistics::Frequencies') || print "Bail out:\n";

} my $table = Statistics:Frequencies→new(); #ver se cria tabela vazia ok $table, “Tabela vazia”; #= if ($table) {print “ok 2\n”} else {print “nok 2\n”}

#verifica tipo is ref($table), “Statistics::Frequencies”, “tem o tipo certo”;

#ver se a tabela é uma hash vazia #is_deeply $table, { }, “tem estrutura certa”; is_deeply $table, { freqs ⇒ {} }, “tem estrutura certa”;

$table→add(“palavra”); ok exists($table→{freqs}{palavra}); is $table→{freqs}{palavra}, 1;

diag(“ Testing Statistics::Frequencies $Statistics::Frequencies::VERSION”)

#done_testing(); #→para evitar ter o “plan tests” para nao andar sempre a mudar e quando terminar mudasse o plan tests

#testar manualmente: #prove t/00-load.t #prove -v t/00-load.t → testes á mão

spln2016/diario7/diario.1460551935.txt.gz · Last modified: 2016/04/13 14:52 by ambs