diff --git a/hphp/test/ext/test_ext.h b/hphp/test/ext/test_ext.h index caff1ce20..4b305ab60 100644 --- a/hphp/test/ext/test_ext.h +++ b/hphp/test/ext/test_ext.h @@ -34,7 +34,6 @@ #include "hphp/facebook/extensions/string_buffer/test_ext_string_buffer.h" #include "hphp/facebook/extensions/tao/test_ext_tao.h" #include "hphp/facebook/extensions/urlextraction/test_ext_urlextraction.h" -#include "hphp/test/ext/test_ext_bzip2.h" #include "hphp/test/ext/test_ext_curl.h" #include "hphp/test/ext/test_ext_file.h" #include "hphp/test/ext/test_ext_hash.h" diff --git a/hphp/test/ext/test_ext_bzip2.cpp b/hphp/test/ext/test_ext_bzip2.cpp deleted file mode 100644 index c779f2392..000000000 --- a/hphp/test/ext/test_ext_bzip2.cpp +++ /dev/null @@ -1,133 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | HipHop for PHP | - +----------------------------------------------------------------------+ - | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#include "hphp/test/ext/test_ext_bzip2.h" -#include "hphp/runtime/ext/ext_bzip2.h" - -IMPLEMENT_SEP_EXTENSION_TEST(Bzip2); -/////////////////////////////////////////////////////////////////////////////// - -bool TestExtBzip2::RunTests(const std::string &which) { - bool ret = true; - - RUN_TEST(test_bzclose); - RUN_TEST(test_bzopen); - RUN_TEST(test_bzread); - RUN_TEST(test_bzwrite); - RUN_TEST(test_bzflush); - RUN_TEST(test_bzerrstr); - RUN_TEST(test_bzerror); - RUN_TEST(test_bzerrno); - RUN_TEST(test_bzcompress); - RUN_TEST(test_bzdecompress); - - return ret; -} - -/////////////////////////////////////////////////////////////////////////////// - -bool TestExtBzip2::test_bzclose() { - return Count(true); -} - -bool TestExtBzip2::test_bzopen() { - return Count(true); -} - -bool TestExtBzip2::test_bzread() { - return Count(true); -} - -bool TestExtBzip2::test_bzwrite() { - String str = "HipHop for"; - Variant bz = f_bzopen("test/test_ext_bzip2.tmp", "w"); - VERIFY(bz); - VS(f_bzwrite(bz, str), 10); - f_bzflush(bz); - VERIFY(f_bzclose(bz)); - - bz = f_bzopen("test/test_ext_bzip2.tmp", "r"); - Variant ret = f_bzread(bz, 10000); - VS(ret, str); - VERIFY(f_bzclose(bz)); - VS(ret, str); - f_unlink("test/test_ext_bzip2.tmp"); - return Count(true); -} - -bool TestExtBzip2::test_bzflush() { - return Count(true); -} - -bool TestExtBzip2::test_bzerrstr() { - Variant f = f_fopen("test/test_ext_bzip2.tmp", "w"); - f_fwrite(f, "this is a test"); - f_fclose(f); - f = f_bzopen("test/test_ext_bzip2.tmp", "r"); - f_bzread(f); - String ret = f_bzerrstr(f); - f_bzclose(f); - f_unlink("test/test_ext_bzip2.tmp"); - VS(ret, "DATA_ERROR_MAGIC"); - return Count(true); -} - -bool TestExtBzip2::test_bzerror() { - Variant f = f_fopen("test/test_ext_bzip2.tmp", "w"); - f_fwrite(f, "this is a test"); - f_fclose(f); - f = f_bzopen("test/test_ext_bzip2.tmp", "r"); - f_bzread(f); - Variant ret = f_bzerror(f); - f_bzclose(f); - f_unlink("test/test_ext_bzip2.tmp"); - VS(ret, CREATE_MAP2("errno", -5, "errstr", "DATA_ERROR_MAGIC")); - return Count(true); -} - -bool TestExtBzip2::test_bzerrno() { - Variant f = f_fopen("test/test_ext_bzip2.tmp", "w"); - f_fwrite(f, "this is a test"); - f_fclose(f); - f = f_bzopen("test/test_ext_bzip2.tmp", "r"); - f_bzread(f); - int ret = f_bzerrno(f); - f_bzclose(f); - f_unlink("test/test_ext_bzip2.tmp"); - VS(ret, -5); - return Count(true); -} - -bool TestExtBzip2::test_bzcompress() { - return Count(true); -} - -bool TestExtBzip2::test_bzdecompress() { - String str = "HipHop for PHP transforms PHP source code into highly optimized C++."; - String ret; - ret = f_bzcompress(str); - ret = f_bzcompress(ret); - ret = f_bzcompress(ret); - ret = f_bzdecompress(ret); - ret = f_bzdecompress(ret); - ret = f_bzdecompress(ret); - VS(ret, str); - str = StringUtil::Repeat("x", 1000); - ret = f_bzcompress(str); - ret = f_bzdecompress(ret); - VS(ret, str); - return Count(true); -} diff --git a/hphp/test/ext/test_ext_bzip2.h b/hphp/test/ext/test_ext_bzip2.h deleted file mode 100644 index 07e2917f1..000000000 --- a/hphp/test/ext/test_ext_bzip2.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - +----------------------------------------------------------------------+ - | HipHop for PHP | - +----------------------------------------------------------------------+ - | Copyright (c) 2010-2013 Facebook, Inc. (http://www.facebook.com) | - +----------------------------------------------------------------------+ - | This source file is subject to version 3.01 of the PHP license, | - | that is bundled with this package in the file LICENSE, and is | - | available through the world-wide-web at the following url: | - | http://www.php.net/license/3_01.txt | - | If you did not receive a copy of the PHP license and are unable to | - | obtain it through the world-wide-web, please send a note to | - | license@php.net so we can mail you a copy immediately. | - +----------------------------------------------------------------------+ -*/ - -#ifndef incl_HPHP_TEST_EXT_BZIP2_H_ -#define incl_HPHP_TEST_EXT_BZIP2_H_ - -// >>>>>> Generated by idl.php. Do NOT modify. <<<<<< - -#include "hphp/test/ext/test_cpp_ext.h" - -/////////////////////////////////////////////////////////////////////////////// - -class TestExtBzip2 : public TestCppExt { - public: - virtual bool RunTests(const std::string &which); - - bool test_bzclose(); - bool test_bzopen(); - bool test_bzread(); - bool test_bzwrite(); - bool test_bzflush(); - bool test_bzerrstr(); - bool test_bzerror(); - bool test_bzerrno(); - bool test_bzcompress(); - bool test_bzdecompress(); -}; - -/////////////////////////////////////////////////////////////////////////////// - -#endif // incl_HPHP_TEST_EXT_BZIP2_H_ diff --git a/hphp/test/slow/ext_bzip2/bzcompress.php b/hphp/test/slow/ext_bzip2/bzcompress.php new file mode 100644 index 000000000..d7f4bd3a4 --- /dev/null +++ b/hphp/test/slow/ext_bzip2/bzcompress.php @@ -0,0 +1,15 @@ + -5, + "errstr" => "DATA_ERROR_MAGIC")); +} + +test_bzwrite(); +test_bzerrstr(); +test_bzerror(); diff --git a/hphp/test/slow/ext_bzip2/ext_bzip2.php.expect b/hphp/test/slow/ext_bzip2/ext_bzip2.php.expect new file mode 100644 index 000000000..859686428 --- /dev/null +++ b/hphp/test/slow/ext_bzip2/ext_bzip2.php.expect @@ -0,0 +1,8 @@ +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +bool(true)