File: test_prunetree.pl

package info (click to toggle)
sphinxtrain 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 32,572 kB
  • sloc: ansic: 94,052; perl: 8,939; python: 6,702; cpp: 2,044; makefile: 6
file content (74 lines) | stat: -rwxr-xr-x 2,136 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/local/bin/perl

use strict;
require './scripts/testlib.pl';

chomp(my $host=`../config.guess | xargs ../config.sub`);
my $bindir="../src/programs/prunetree/";
my $resdir="res/";
my $exec_resdir="prunetree";
my $bin="$bindir$exec_resdir";

test_help($bindir,$exec_resdir);
test_example($bindir,$exec_resdir);

my $unprunetreedir="./res/trees/CFS3.unpruned/";
my $prunetreedir2000="./res/trees/CFS3.2000/";
my $prunetreedir500="./res/trees/CFS3.500/";
my $prunetreedir100="./res/trees/CFS3.100/";
my $untiedmdef="./res/hmm/CFS3.untied.mdef";
my $questionset="./res/linguistic_questions";
my $testdir="./test_${exec_resdir}";
my $fn;
mkdir "$testdir" || printf("$testdir is already built\n");

my $testcmd="$bin ";
$testcmd .= "-itreedir $unprunetreedir "; 
$testcmd .= "-otreedir $testdir ";
$testcmd .= "-moddeffn $untiedmdef ";
$testcmd .= " -psetfn $questionset ";

test_this($testcmd . "-nseno 2000",$exec_resdir,"DRY RUN 2000 SENONE TEST");
test_this("diff -r --exclude=.svn ./test_${exec_resdir} $prunetreedir2000",$exec_resdir,"TREES MATCH 2000 SENONE TEST");

foreach $fn (glob("$testdir/*"))
{
    unlink $fn;
}

test_this($testcmd . "-nseno 500",$exec_resdir,"DRY RUN 500 SENONE TEST");
test_this("diff -r --exclude=.svn ./test_${exec_resdir} $prunetreedir500",$exec_resdir,"TREES MATCH 500 SENONE TEST");

foreach $fn (glob("$testdir/*"))
{
    unlink $fn;
}


test_this($testcmd . "-nseno 100",$exec_resdir,"DRY RUN 100 SENONE TEST");
test_this("diff -r --exclude=.svn ./test_${exec_resdir} $prunetreedir100",$exec_resdir,"TREES MATCH 100 SENONE TEST");

foreach $fn (glob("$testdir/*"))
{
    unlink $fn;
}


test_this($testcmd . "-nseno 10",$exec_resdir,"DRY RUN 10 SENONE TEST");
test_this("diff -r --exclude=.svn ./test_${exec_resdir} $prunetreedir100",$exec_resdir,"TREES MATCH 10 SENONE TEST");

foreach $fn (glob("$testdir/*"))
{
    unlink $fn;
}


test_this($testcmd . "-nseno 1",$exec_resdir,"DRY RUN 1 SENONE TEST");
test_this("diff -r --exclude=.svn ./test_${exec_resdir} $prunetreedir100",$exec_resdir,"TREES MATCH 1 SENONE TEST");

foreach $fn (glob("$testdir/*"))
{
    unlink $fn;
}

rmdir "$testdir/";