The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/local/bin/perl -w                                                        
                                                                                
# Before `make install' is performed this script should be runnable with        
# `make test'. After `make install' it should work as `perl access.t'           
                                                                                
##################### We start with some black magic to print on failure.       

use strict;
use warnings;

use Test::More tests => 6;

use UMLS::Interface;
use File::Spec;
use File::Path;

if(!(-d "t")) {   
    print STDERR "Error - program must be run from UMLS::Similarity\n";
    print STDERR "directory as : perl t/findCuiDepth.t \n";
    exit;  
}

my $perl     = $^X;
my $util_prg  = File::Spec->catfile('utils', 'umls-similarity.pl');

my ($real, $index, $config, $infile, $indexfile, $realfile, $check);

#############################################################################
#  check path on msh 
#############################################################################
$config    = File::Spec->catfile('t', 'config', 'config.msh.par-chd');
$infile    = File::Spec->catfile('t', 'tests', 'developers', 'msh.100');
$indexfile = File::Spec->catfile('t', 'output', 'msh.100.path.indexfile');
$realfile  = File::Spec->catfile('t', 'output', 'msh.100.path.realfile');

`$perl $util_prg --config $config --infile $infile > $indexfile`;
`$perl $util_prg --config $config --realtime --infile $infile > $realfile`;

$check = `diff $indexfile $realfile 2>&1`;

cmp_ok($check, 'eq', "");

#############################################################################
#  check path on fma 
#############################################################################
$config    = File::Spec->catfile('t', 'config', 'config.fma.par-chd');
$infile    = File::Spec->catfile('t', 'tests', 'developers', 'fma.100');
$indexfile = File::Spec->catfile('t', 'output', 'fma.100.spl.indexfile');
$realfile  = File::Spec->catfile('t', 'output', 'fma.100.spl.realfile');

`$perl $util_prg --config $config --infile $infile > $indexfile`;
`$perl $util_prg --config $config --realtime --infile $infile > $realfile`;

$check = `diff $indexfile $realfile 2>&1`;

cmp_ok($check, 'eq', "");

#############################################################################
#  check path on snomedct 
#############################################################################
$config    = File::Spec->catfile('t', 'config', 'config.snomedct.par-chd');
$infile    = File::Spec->catfile('t', 'tests', 'developers', 'snomedct.100');
$indexfile = File::Spec->catfile('t', 'output', 'snomedct.100.spl.indexfile');
$realfile  = File::Spec->catfile('t', 'output', 'snomedct.100.spl.realfile');

`$perl $util_prg --config $config --infile $infile > $indexfile`;
`$perl $util_prg --config $config --realtime --infile $infile > $realfile`;

$check = `diff $indexfile $realfile 2>&1`;

cmp_ok($check, 'eq', "");