2 +----------------------------------------------------------------------+
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #include "hphp/test/ext/test_base.h"
18 #include <sys/param.h>
19 #include "hphp/compiler/option.h"
20 #include "hphp/test/ext/test.h"
21 #include "hphp/runtime/base/comparisons.h"
22 #include "hphp/runtime/ext/array/ext_array.h"
23 #include "hphp/runtime/ext/std/ext_std_variable.h"
25 ///////////////////////////////////////////////////////////////////////////////
27 TestBase::TestBase() {
28 Option::KeepStatementsWithNoEffect
= true;
31 bool TestBase::Count(bool result
) {
43 bool TestBase::CountSkip() {
50 bool TestBase::VerifySame(const char *exp1
, const char *exp2
,
51 const Variant
& v1
, const Variant
& v2
) {
53 g_context
->obEndAll();
54 printf("%s = \n", exp1
); HHVM_FN(var_dump
)(v1
);
55 printf("%s = \n", exp2
); HHVM_FN(var_dump
)(v2
);
61 bool TestBase::VerifyClose(const char *exp1
, const char *exp2
,
62 double v1
, double v2
) {
63 double diff
= v1
> v2
? v1
- v2
: v2
- v1
;
65 g_context
->obEndAll();
66 printf("%s = \n", exp1
); HHVM_FN(var_dump
)(v1
);
67 printf("%s = \n", exp2
); HHVM_FN(var_dump
)(v2
);
73 bool TestBase::array_value_exists(const Variant
& var
, const Variant
& value
) {
75 Variant::attach(HHVM_FN(array_search
)(value
, var
.toArray())),
79 HHVM_FN(var_dump
)(var
);