@Override public Number convert(Environment env, TraceInfo trace, Memory arg) throws Throwable { switch (arg.getRealType()) { case DOUBLE: return arg.toDouble(); case INT: return arg.toInteger(); default: return convert(env, trace, arg.toNumeric()); } }
@Test public void testComplex() { Memory memory = includeResource("unset/complex.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testObjectValue() { Memory memory = includeResource("unset/object_value.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testRefArrayValue() { Memory memory = includeResource("unset/ref_array_value.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testRefInMethodVariables() { Memory memory = includeResource("unset/ref_in_method_variables.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testVariables() { Memory memory = includeResource("unset/variables.php"); Assert.assertEquals("success", memory.toString()); }
public static String getGivenName(Memory value) { if (value.isObject()) return "an instance of " + value.toValue(ObjectMemory.class).getReflection().getName(); else return value.getRealType().toString(); }
@Test public void testIncDec() { Memory memory = includeResource("expressions/inc_dec.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testComplexAssign() { Memory memory = includeResource("expressions/complex_assign.php"); Assert.assertEquals("success", memory.toString()); }
@Test public void testPlusMinusMulDiv() { Memory memory = includeResource("expressions/plus_minus_mul_div.php"); Assert.assertEquals("success", memory.toString()); }