tony2001 Mon Jun 26 22:20:55 2006 UTC Modified files: /php-src/ext/bz2/tests 003.phpt 003.txt.bz2 004.phpt 004_1.txt.bz2 004_2.txt.bz2 005.phpt 001.phpt 002.phpt Log: add new tests, improve the old ones
http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/003.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/003.phpt diff -u /dev/null php-src/ext/bz2/tests/003.phpt:1.2 --- /dev/null Mon Jun 26 22:20:55 2006 +++ php-src/ext/bz2/tests/003.phpt Mon Jun 26 22:20:55 2006 @@ -0,0 +1,40 @@ +--TEST-- +bzread() tests +--SKIPIF-- +<?php if (!extension_loaded("bz2")) print "skip"; ?> +--FILE-- +<?php + +$fd = bzopen(dirname(__FILE__)."/003.txt.bz2","r"); +var_dump(bzread()); +var_dump(bzread($fd, 1 ,0)); +var_dump(bzread($fd, 0)); +var_dump(bzread($fd, -10)); +var_dump(bzread($fd, 1)); +var_dump(bzread($fd, 2)); +var_dump(bzread($fd, 100000)); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: bzread() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: bzread() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +string(0) "" + +Warning: bzread(): length may not be negative in %s on line %d +bool(false) +string(1) "R" +string(2) "is" +string(251) "ing up from the heart of the desert +Rising up for Jerusalem +Rising up from the heat of the desert +Building up Old Jerusalem +Rising up from the heart of the desert +Rising up for Jerusalem +Rising up from the heat of the desert +Heading out for Jerusalem +" +Done http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/003.txt.bz2?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/003.txt.bz2 http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/004.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/004.phpt diff -u /dev/null php-src/ext/bz2/tests/004.phpt:1.2 --- /dev/null Mon Jun 26 22:20:55 2006 +++ php-src/ext/bz2/tests/004.phpt Mon Jun 26 22:20:55 2006 @@ -0,0 +1,177 @@ +--TEST-- +bzread() tests with invalid files +--SKIPIF-- +<?php if (!extension_loaded("bz2")) print "skip"; ?> +--FILE-- +<?php + +$fd = bzopen(dirname(__FILE__)."/004_1.txt.bz2","r"); +var_dump(bzerror($fd)); +var_dump(bzerrstr($fd)); +var_dump(bzerrno($fd)); + +$fd2 = bzopen(dirname(__FILE__)."/004_2.txt.bz2","r"); +var_dump(bzerror($fd2)); +var_dump(bzerrstr($fd2)); +var_dump(bzerrno($fd2)); + +var_dump(bzread($fd, 10)); +var_dump(bzerror($fd)); +var_dump(bzerrstr($fd)); +var_dump(bzerrno($fd)); + +var_dump(bzread($fd2, 10)); +var_dump(bzerror($fd2)); +var_dump(bzerrstr($fd2)); +var_dump(bzerrno($fd2)); + +var_dump(bzread($fd)); +var_dump(bzerror($fd)); +var_dump(bzerrstr($fd)); +var_dump(bzerrno($fd)); + +var_dump(bzread($fd2)); +var_dump(bzerror($fd2)); +var_dump(bzerrstr($fd2)); +var_dump(bzerrno($fd2)); + +bzclose($fd2); +var_dump(bzread($fd2)); +var_dump(bzerror($fd2)); +var_dump(bzerrstr($fd2)); +var_dump(bzerrno($fd2)); + +echo "Done\n"; +?> +--EXPECTF-- +array(2) { + ["errno"]=> + int(0) + ["errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +array(2) { + ["errno"]=> + int(0) + ["errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +string(0) "" +array(2) { + ["errno"]=> + int(-5) + ["errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + ["errno"]=> + int(-4) + ["errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) +string(0) "" +array(2) { + ["errno"]=> + int(-5) + ["errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + ["errno"]=> + int(-4) + ["errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) + +Warning: bzread(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerror(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrstr(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrno(): %d is not a valid stream resource in %s on line %d +bool(false) +Done +--UEXPECTF-- +array(2) { + [u"errno"]=> + int(0) + [u"errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +array(2) { + [u"errno"]=> + int(0) + [u"errstr"]=> + string(2) "OK" +} +string(2) "OK" +int(0) +string(0) "" +array(2) { + [u"errno"]=> + int(-5) + [u"errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + [u"errno"]=> + int(-4) + [u"errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) +string(0) "" +array(2) { + [u"errno"]=> + int(-5) + [u"errstr"]=> + string(16) "DATA_ERROR_MAGIC" +} +string(16) "DATA_ERROR_MAGIC" +int(-5) +string(0) "" +array(2) { + [u"errno"]=> + int(-4) + [u"errstr"]=> + string(10) "DATA_ERROR" +} +string(10) "DATA_ERROR" +int(-4) + +Warning: bzread(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerror(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrstr(): %d is not a valid stream resource in %s on line %d +bool(false) + +Warning: bzerrno(): %d is not a valid stream resource in %s on line %d +bool(false) +Done http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/004_1.txt.bz2?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/004_1.txt.bz2 http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/004_2.txt.bz2?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/004_2.txt.bz2 http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/005.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/005.phpt diff -u /dev/null php-src/ext/bz2/tests/005.phpt:1.2 --- /dev/null Mon Jun 26 22:20:55 2006 +++ php-src/ext/bz2/tests/005.phpt Mon Jun 26 22:20:55 2006 @@ -0,0 +1,71 @@ +--TEST-- +bzcompress()/bzdecompress() tests +--SKIPIF-- +<?php if (!extension_loaded("bz2")) print "skip"; ?> +--FILE-- +<?php + +$string = "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else"; + +var_dump(bzcompress()); +var_dump(bzcompress(1,1,1)); +var_dump(bzcompress($string, 100)); +var_dump(bzcompress($string, 100, -1)); +var_dump(bzcompress($string, 100, 1000)); +var_dump(bzcompress($string, -1, 1)); + +$data = bzcompress($string); +$data2 = bzcompress($string, 1, 10); + +$data3 = $data2; +$data3{3} = 0; + +var_dump(bzdecompress()); +var_dump(bzdecompress(1,1,1)); +var_dump(bzdecompress(1,1)); +var_dump(bzdecompress($data3)); +var_dump(bzdecompress($data3,1)); + +var_dump(bzdecompress($data, -1)); +var_dump(bzdecompress($data, 0)); +var_dump(bzdecompress($data, 1000)); +var_dump(bzdecompress($data)); +var_dump(bzdecompress($data2)); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: Wrong parameter count for bzcompress() in %s on line %d +NULL +string(%d) "BZ%s" +int(-2) +int(-2) +int(-2) +int(-2) + +Warning: bzdecompress() expects at least 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: bzdecompress() expects at most 2 parameters, 3 given in %s on line %d +bool(false) +int(-5) +int(-5) +int(-5) +bool(false) +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +bool(false) +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +string(110) "Life it seems, will fade away +Drifting further everyday +Getting lost within myself +Nothing matters no one else" +Done http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/001.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/001.phpt diff -u php-src/ext/bz2/tests/001.phpt:1.1 php-src/ext/bz2/tests/001.phpt:1.2 --- php-src/ext/bz2/tests/001.phpt:1.1 Wed Jun 21 14:38:06 2006 +++ php-src/ext/bz2/tests/001.phpt Mon Jun 26 22:20:55 2006 @@ -1,5 +1,7 @@ --TEST-- bzopen() and invalid parameters +--SKIPIF-- +<?php if (!extension_loaded("bz2")) print "skip"; ?> --FILE-- <?php http://cvs.php.net/viewvc.cgi/php-src/ext/bz2/tests/002.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/bz2/tests/002.phpt diff -u php-src/ext/bz2/tests/002.phpt:1.1 php-src/ext/bz2/tests/002.phpt:1.2 --- php-src/ext/bz2/tests/002.phpt:1.1 Wed Jun 21 14:38:06 2006 +++ php-src/ext/bz2/tests/002.phpt Mon Jun 26 22:20:55 2006 @@ -1,5 +1,7 @@ --TEST-- bzopen() using fd opened in wrong mode +--SKIPIF-- +<?php if (!extension_loaded("bz2")) print "skip"; ?> --FILE-- <?php
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php