~ubuntu-branches/ubuntu/trusty/sphinxsearch/trusty-proposed

« back to all changes in this revision

Viewing changes to test/test_28/test.inc

  • Committer: Bazaar Package Importer
  • Author(s): Radu Spineanu
  • Date: 2009-11-17 22:19:42 UTC
  • Revision ID: james.westby@ubuntu.com-20091117221942-nm751ur701m9vrzt
Tags: upstream-0.9.8.1
ImportĀ upstreamĀ versionĀ 0.9.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
printf ( "testing $test_path, spelldump... " );
 
2
 
 
3
$windows = isset($_SERVER["WINDIR"]) || isset($_SERVER["windir"]) || isset($_SERVER["HOMEDRIVE"]);
 
4
 
 
5
if ( $windows )
 
6
        $spelldump_path = "..\\bin\\debug\\spelldump";
 
7
else
 
8
        $spelldump_path = "../src/spelldump";
 
9
 
 
10
global $g_model;
 
11
if ( $g_model )
 
12
{
 
13
        exec ( "$spelldump_path $test_path/model.dict $test_path/model.aff $test_path/model.spell", $error, $retval );
 
14
 
 
15
        if ( !file_exists ( "$test_path/model.spell" ) )
 
16
                return false;
 
17
 
 
18
        printf ( "done; 1/1 subtests OK\n" );
 
19
        return true;
 
20
}
 
21
 
 
22
exec ( "$spelldump_path $test_path/model.dict $test_path/model.aff $test_path/current.spell", $error, $retval );
 
23
 
 
24
if ( !file_exists ( "$test_path/current.spell" ) )
 
25
        return false;
 
26
 
 
27
$model = file_get_contents ( "$test_path/model.spell" );
 
28
$result = file_get_contents ( "$test_path/current.spell" );
 
29
if ( $model != $result )
 
30
{
 
31
        if ( $windows )
 
32
                system ( "diff -u3 $test_path/model.spell $test_path/current.spell > $test_path/report.txt" );
 
33
        else
 
34
                system ( "diff $test_path/model.spell $test_path/current.spell > $test_path/report.txt" );
 
35
 
 
36
        printf ( "FAILED\n" );
 
37
        return false;
 
38
}
 
39
 
 
40
unlink ( "$test_path/current.spell" );
 
41
printf ( "done; 1/1 subtests OK\n" );
 
42
 
 
43
return true;
 
 
b'\\ No newline at end of file'