Browse Source
added misc tests in the repository (exist already for a long time)
hg/35a367e65a464cf6cdf277c73f977a6828b723fe/bookmarks/master
added misc tests in the repository (exist already for a long time)
hg/35a367e65a464cf6cdf277c73f977a6828b723fe/bookmarks/master

3 changed files with 145 additions and 1 deletions
@ -0,0 +1,123 @@ |
|||
<? |
|||
|
|||
$_GET['test']=''; |
|||
define('BIBTEXBROWSER_SCRIPT',dirname(__FILE__).'/../bibtexbrowser.php'); |
|||
include(BIBTEXBROWSER_SCRIPT); |
|||
|
|||
ob_start(); |
|||
function testshortopentags() { |
|||
preg_match_all('/<\?[\s$\/]/',file_get_contents(BIBTEXBROWSER_SCRIPT),$matches); |
|||
//echo count($matches[0]);
|
|||
return array('short PHP tag <? ',count($matches[0])==0); |
|||
} |
|||
|
|||
|
|||
function testLatex2html0() { |
|||
$str='\`a\`{a}'; |
|||
//echo htmlentities(latex2html($str));
|
|||
return array('transformation of accents',latex2html($str)=='àà'); |
|||
} |
|||
|
|||
function testLatex2html1() { |
|||
//echo htmlentities(latex2html('&'));
|
|||
//echo htmlentities(latex2html('\&'));
|
|||
return array('transformation of ampersamd',latex2html('\&')=='&'); |
|||
} |
|||
|
|||
function testLatex2html2() { |
|||
$str='\~nsdf~sd\~a'; |
|||
//echo htmlentities(latex2html($str));
|
|||
return array('transformation of non breaking space',latex2html($str)=='ñsdf sdã'); |
|||
} |
|||
|
|||
function testLatex2html3() { |
|||
$str='asd {sdsdf}'; |
|||
return array('transformation of curly braces (serge\'s bug)',latex2html($str)=='asd sdsdf'); |
|||
} |
|||
|
|||
|
|||
function test_search1() { |
|||
// see http://www.monperrus.net/martin/bibtexbrowser.php?search=banach+space&bib=bibacid.bib
|
|||
$_GET['bib']='input/bibacid-iso8859.bib'; |
|||
setDB(); |
|||
$query= array (Q_SEARCH=>'banach space'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
return array('search for banach space (latex markup)',count($selected)==5); |
|||
} |
|||
|
|||
// see http://www.monperrus.net/martin/bibtexbrowser.php?search=g%F6del&bib=bibacid.bib
|
|||
|
|||
function test_search2() { |
|||
$_GET['bib']='input/bibacid-iso8859.bib'; |
|||
setDB(); |
|||
$query= array (Q_SEARCH=>'gödel'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
//echo var_export($selected);
|
|||
return array('search for goedel (latex and accents)',count($selected)==5); |
|||
} |
|||
|
|||
function test_search2a() { |
|||
$_GET['bib']='input/bibacid-iso8859.bib'; |
|||
setDB(); |
|||
$query= array (Q_SEARCH=>'g'.html_entity_decode('ö').'del'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
//echo var_export($selected);
|
|||
return array('search for goedel (latex and accents)',count($selected)==5); |
|||
} |
|||
|
|||
function test_search2b() { |
|||
$_GET['bib']='input/bibacid-iso8859.bib'; |
|||
setDB(); |
|||
$query= array (Q_SEARCH=>'g'.utf8_encode(html_entity_decode('ö')).'del'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
//echo var_export($selected);
|
|||
return array('search for goedel (latex and accents)',count($selected)==5); |
|||
} |
|||
|
|||
|
|||
function test_search3() { |
|||
$_GET['bib']='input/metrics.bib'; |
|||
setDB(); |
|||
$query= array (Q_SEARCH=>'ocl'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
return array('search for OCL',count($selected)==4); |
|||
} |
|||
|
|||
function test_search4() { |
|||
$_GET['bib']='input/metrics.bib'; |
|||
setDB(); |
|||
$query= array (Q_TYPE=>'book'); |
|||
$selected = $_GET[Q_DB]->multisearch($query); |
|||
return array('search for TYPE:book',count($selected)==17); |
|||
} |
|||
|
|||
$tests = array( |
|||
'testLatex2html0', |
|||
'testLatex2html1', |
|||
'testLatex2html2', |
|||
'testLatex2html3', |
|||
'testshortopentags', |
|||
'test_search1', |
|||
'test_search2', |
|||
'test_search2a', |
|||
'test_search2b', |
|||
'test_search3', |
|||
'test_search4', |
|||
|
|||
); |
|||
|
|||
foreach ($tests as $test) { |
|||
echo "running ".$test.": "; |
|||
list($description,$result)=$test(); |
|||
echo "\n"; |
|||
// $color= $result?'green':'red';
|
|||
// echo '<span style="color:'.$color.'">'.$description.'</span><br/>';
|
|||
$symbol= $result?' -- ':' XX '; |
|||
echo $symbol.$description."\n"; |
|||
} |
|||
|
|||
$testresult = ob_get_clean(); |
|||
file_put_contents('output/03_misc.txt',$testresult); |
|||
echo $testresult; |
|||
?>
|
|||
|
@ -0,0 +1,22 @@ |
|||
running testLatex2html0: |
|||
-- transformation of accents |
|||
running testLatex2html1: |
|||
-- transformation of ampersamd |
|||
running testLatex2html2: |
|||
-- transformation of non breaking space |
|||
running testLatex2html3: |
|||
-- transformation of curly braces (serge's bug) |
|||
running testshortopentags: |
|||
-- short PHP tag <? |
|||
running test_search1: |
|||
-- search for banach space (latex markup) |
|||
running test_search2: |
|||
-- search for goedel (latex and accents) |
|||
running test_search2a: |
|||
-- search for goedel (latex and accents) |
|||
running test_search2b: |
|||
XX search for goedel (latex and accents) |
|||
running test_search3: |
|||
-- search for OCL |
|||
running test_search4: |
|||
-- search for TYPE:book |
Write
Preview
Loading…
Cancel
Save
Reference in new issue