diff --git a/test/01_output.php b/test/01_output.php
index 8cfe08d..bf16a1a 100644
--- a/test/01_output.php
+++ b/test/01_output.php
@@ -79,7 +79,6 @@ foreach($url as $desc => $query_string) {
echo xml_get_current_line_number ( $xmlparser )."
";
echo xml_get_current_column_number ( $xmlparser )."
";
}
-
}
diff --git a/test/03_misc.php b/test/03_misc.php
new file mode 100644
index 0000000..c6d1fea
--- /dev/null
+++ b/test/03_misc.php
@@ -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 ''.$description.'
';
+ $symbol= $result?' -- ':' XX ';
+ echo $symbol.$description."\n";
+}
+
+$testresult = ob_get_clean();
+file_put_contents('output/03_misc.txt',$testresult);
+echo $testresult;
+?>
+
diff --git a/test/output/03_misc.txt b/test/output/03_misc.txt
new file mode 100644
index 0000000..813846c
--- /dev/null
+++ b/test/output/03_misc.txt
@@ -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