nlopess         Wed Jun 28 14:42:32 2006 UTC

  Removed files:               
    /php-src/ext/pspell/tests   01pspell_basic.phpt 

  Modified files:              
    /php-src/ext/pspell/tests   001.phpt 002.phpt 003.phpt 004.phpt 
                                005.phpt wordlist.txt .cvsignore 
  Log:
  MFB
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/001.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/001.phpt
diff -u /dev/null php-src/ext/pspell/tests/001.phpt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/001.phpt   Wed Jun 28 14:42:32 2006
@@ -0,0 +1,116 @@
+--TEST--
+pspell basic tests (warning: may fail with pspell/aspell < GNU Aspell 0.50.3)
+--SKIPIF--
+<?php 
+if (!extension_loaded("pspell")) die("skip");
+if ([EMAIL PROTECTED] ("en", "", "", "", (PSPELL_FAST|PSPELL_RUN_TOGETHER))) {
+       die("skip English dictionary is not available");
+}
+?>
+--FILE--
+<?php // $Id: 001.phpt,v 1.2 2006/06/28 14:42:32 nlopess Exp $
+
+error_reporting(E_ALL);
+$string = "";
+$string .= "I will not buy this record, it is scratched. ";
+$string .= "Sorry ";
+$string .= "I will not buy this record, it is scratched. ";
+$string .= "Uh, no, no, no. This is a tobacconist's ";
+$string .= "Ah! I will not buy this tobacconist's, it is scratched. ";
+$string .= "No, no, no, no. Tobacco... um... cigarettes (holds up a pack). ";
+$string .= "Ya! See-gar-ets! Ya! Uh... My hovercraft is full of eels. ";
+$string .= "Sorry? ";
+$string .= "My hovercraft (pantomimes puffing a cigarette)... is full of eels 
(pretends to strike a match). ";
+$string .= "Ahh, matches!";
+
+$pspell = pspell_new ("en", "", "", "", (PSPELL_FAST|PSPELL_RUN_TOGETHER));
+$array = explode(' ',preg_replace('/[^a-zA-Z0-9 ]/','',$string));
+for($i=0,$u=count($array);$i<$u;++$i) {
+    echo $array[$i].' : ';
+    if (!pspell_check($pspell, $array[$i])) {
+        echo "..false\n";
+        echo "Possible spellings: " . join(',',pspell_suggest ($pspell, 
$array[$i])) . "\n"; 
+    } else {
+        echo "true\n";
+    }
+}
+?>
+--EXPECTF--
+I : true
+will : true
+not : true
+buy : true
+this : true
+record : true
+it : true
+is : true
+scratched : true
+Sorry : true
+I : true
+will : true
+not : true
+buy : true
+this : true
+record : true
+it : true
+is : true
+scratched : true
+Uh : true
+no : true
+no : true
+no : true
+This : true
+is : true
+a : true
+tobacconists : true
+Ah : true
+I : true
+will : true
+not : true
+buy : true
+this : true
+tobacconists : true
+it : true
+is : true
+scratched : true
+No : true
+no : true
+no : true
+no : true
+Tobacco : true
+um : true
+cigarettes : true
+holds : true
+up : true
+a : true
+pack : true
+Ya : true
+Seegarets : ..false
+Possible spellings:%s,Regrets,%s,Cigarettes,%s
+Ya : true
+Uh : true
+My : true
+hovercraft : true
+is : true
+full : true
+of : true
+eels : true
+Sorry : true
+My : true
+hovercraft : true
+pantomimes : true
+puffing : true
+a : true
+cigarette : true
+is : true
+full : true
+of : true
+eels : true
+pretends : true
+to : true
+strike : true
+a : true
+match : true
+Ahh : ..false
+Possible spellings:%sAh,Aha,%s
+matches : true
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/002.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/002.phpt
diff -u /dev/null php-src/ext/pspell/tests/002.phpt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/002.phpt   Wed Jun 28 14:42:32 2006
@@ -0,0 +1,38 @@
+--TEST--
+pspell session
+--SKIPIF--
+<?php
+if (!extension_loaded('pspell')) die('skip');
+if ([EMAIL PROTECTED]('en')) die('skip English dictionary is not available');
+?>
+--FILE--
+<?php
+
+$p = pspell_new('en');
+
+var_dump(pspell_check('a'));
+var_dump(pspell_check($p, 'somebogusword'));
+
+var_dump(pspell_add_to_session($p, ''));
+var_dump(pspell_add_to_session($p, 'somebogusword'));
+var_dump(pspell_check($p, 'somebogusword'));
+
+var_dump(pspell_clear_session(new stdclass));
+var_dump(pspell_clear_session($p));
+var_dump(pspell_check($p, 'somebogusword'));
+
+?>
+--EXPECTF--
+Warning: Wrong parameter count for pspell_check() in %s002.php on line 5
+NULL
+bool(false)
+bool(false)
+bool(true)
+bool(true)
+
+Notice: Object of class stdClass could not be converted to int in %s002.php on 
line 12
+
+Warning: pspell_clear_session(): 1 is not a PSPELL result index in %s002.php 
on line 12
+bool(false)
+bool(true)
+bool(false)
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/003.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/003.phpt
diff -u /dev/null php-src/ext/pspell/tests/003.phpt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/003.phpt   Wed Jun 28 14:42:32 2006
@@ -0,0 +1,39 @@
+--TEST--
+pspell_config_ignore
+--SKIPIF--
+<?php
+if (!extension_loaded('pspell')) die('skip');
+if ([EMAIL PROTECTED]('en')) die('skip English dictionary is not available');
+?>
+--FILE--
+<?php
+
+$cfg = pspell_config_create('en', 'british', '', 'iso8859-1');
+$cfg2 = pspell_config_create('en', 'british', '', 'b0rked');
+
+$p = pspell_new_config($cfg);
+var_dump(pspell_check($p, 'yy'));
+
+$p2 = pspell_new_config($cfg2);
+var_dump(pspell_check($p2, 'yy'));
+
+echo "---\n";
+var_dump(pspell_config_ignore($cfg, 2));
+$p = pspell_new_config($cfg);
+var_dump(pspell_check($p, 'yy'));
+
+// segfault it?
+var_dump(pspell_config_ignore($cfg, PHP_INT_MAX));
+
+?>
+--EXPECTF--
+bool(false)
+
+Warning: pspell_new_config(): PSPELL couldn't open the dictionary. reason: The 
encoding "b0rked" is not known.  This could also mean that the file 
"%sb0rked.dat" could not be opened for reading or does not exist.  in %s003.php 
on line 9
+
+Warning: pspell_check(): 0 is not a PSPELL result index in %s003.php on line 10
+bool(false)
+---
+bool(true)
+bool(true)
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/004.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/004.phpt
diff -u /dev/null php-src/ext/pspell/tests/004.phpt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/004.phpt   Wed Jun 28 14:42:32 2006
@@ -0,0 +1,35 @@
+--TEST--
+pspell configs
+--SKIPIF--
+<?php
+if (!extension_loaded('pspell')) die('skip');
+if ([EMAIL PROTECTED]('en')) die('skip English dictionary is not available');
+?>
+--FILE--
+<?php
+
+$cfg = pspell_config_create('en', 'british', '', 'iso8859-1');
+var_dump(pspell_config_mode($cfg, PSPELL_BAD_SPELLERS));
+
+var_dump(pspell_config_runtogether($cfg, false));
+$p = pspell_new_config($cfg);
+var_dump(pspell_check($p, 'theoasis'));
+
+echo "---\n";
+
+// now it should pass
+var_dump(pspell_config_runtogether($cfg, true));
+$p = pspell_new_config($cfg);
+var_dump(pspell_check($p, 'theoasis'));
+
+var_dump(pspell_config_runtogether($cfg, NULL))
+
+?>
+--EXPECT--
+bool(true)
+bool(true)
+bool(false)
+---
+bool(true)
+bool(true)
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/005.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/005.phpt
diff -u /dev/null php-src/ext/pspell/tests/005.phpt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/005.phpt   Wed Jun 28 14:42:32 2006
@@ -0,0 +1,46 @@
+--TEST--
+pspell configs
+--SKIPIF--
+<?php
+if (!extension_loaded('pspell')) die('skip');
+if ([EMAIL PROTECTED]('en')) die('skip English dictionary is not available');
+?>
+--FILE--
+<?php
+
+$wordlist = dirname(__FILE__).'/wordlist.txt';
+
+var_dump(pspell_new_personal(__FILE__, 'en'));
+$p = pspell_new_personal($wordlist, 'en');
+
+var_dump(pspell_check($p, 'dfnvnsafksfksf'));
+
+echo "--\n";
+$cfg = pspell_config_create('en');
+var_dump(pspell_config_personal($cfg, "$wordlist.tmp"));
+$p = pspell_new_config($cfg);
+
+copy($wordlist, "$wordlist.tmp");
+
+var_dump(pspell_check($p, 'ola'));
+var_dump(pspell_add_to_personal($p, 'ola'));
+var_dump(pspell_check($p, 'ola'));
+
+echo "--\n";
+var_dump(pspell_save_wordlist($p));
+var_dump(strpos(file_get_contents("$wordlist.tmp"), 'ola') !== FALSE);
+
+unlink("$wordlist.tmp");
+?>
+--EXPECTF--
+Warning: pspell_new_personal(): PSPELL couldn't open the dictionary. reason: 
The file "%s005.php" is not in the proper format.  in %s005.php on line 5
+bool(false)
+bool(true)
+--
+bool(true)
+bool(false)
+bool(true)
+bool(true)
+--
+bool(true)
+bool(true)
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/wordlist.txt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/pspell/tests/wordlist.txt
diff -u /dev/null php-src/ext/pspell/tests/wordlist.txt:1.2
--- /dev/null   Wed Jun 28 14:42:32 2006
+++ php-src/ext/pspell/tests/wordlist.txt       Wed Jun 28 14:42:32 2006
@@ -0,0 +1,5 @@
+personal_ws-1.1 en 4
+dfnvnsafksfksf
+fg
+iufrsn
+jsksjfsjf
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/.cvsignore?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/pspell/tests/.cvsignore
diff -u php-src/ext/pspell/tests/.cvsignore:1.7 
php-src/ext/pspell/tests/.cvsignore:1.8
--- php-src/ext/pspell/tests/.cvsignore:1.7     Sun Oct 10 16:10:04 2004
+++ php-src/ext/pspell/tests/.cvsignore Wed Jun 28 14:42:32 2006
@@ -6,3 +6,4 @@
 *.php
 *.gcda
 *.gcno
+*.tmp

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to