Search in sources :

Example 56 with Memory

use of php.runtime.Memory in project jphp by jphp-compiler.

the class UserFunctionTest method testStaticVariables.

@Test
public void testStaticVariables() {
    Memory memory = includeResource("user_function/static_variables.php");
    Assert.assertEquals(33, memory.toLong());
}
Also used : Memory(php.runtime.Memory) ArrayMemory(php.runtime.memory.ArrayMemory) Test(org.junit.Test)

Example 57 with Memory

use of php.runtime.Memory in project jphp by jphp-compiler.

the class UserFunctionTest method testBasic.

@Test
public void testBasic() {
    Memory memory = includeResource("user_function/basic.php");
    Assert.assertEquals(20, memory.toLong());
}
Also used : Memory(php.runtime.Memory) ArrayMemory(php.runtime.memory.ArrayMemory) Test(org.junit.Test)

Example 58 with Memory

use of php.runtime.Memory in project jphp by jphp-compiler.

the class NamespacesTest method testSimple.

@Test
public void testSimple() {
    Memory memory = includeResource("namespaces/simple.php");
    Assert.assertEquals("success", memory.toString());
}
Also used : Memory(php.runtime.Memory) Test(org.junit.Test)

Example 59 with Memory

use of php.runtime.Memory in project jphp by jphp-compiler.

the class SimpleExpressionTest method testCallNativeFunc.

@Test
public void testCallNativeFunc() {
    Memory memory = runDynamic("$i = 1; return cos($i);", false);
    Assert.assertTrue(memory.toDouble() > 0.54);
}
Also used : Memory(php.runtime.Memory) Test(org.junit.Test)

Example 60 with Memory

use of php.runtime.Memory in project jphp by jphp-compiler.

the class SimpleExpressionTest method testStringBuilder.

@Test
public void testStringBuilder() {
    Memory memory;
    memory = runDynamic("$x = 100500; return \"foo $x bar\";", false);
    Assert.assertEquals("foo 100500 bar", memory.toString());
}
Also used : Memory(php.runtime.Memory) Test(org.junit.Test)

Aggregations

Memory (php.runtime.Memory)346 Test (org.junit.Test)124 ArrayMemory (php.runtime.memory.ArrayMemory)122 ObjectMemory (php.runtime.memory.ObjectMemory)75 LongMemory (php.runtime.memory.LongMemory)58 StringMemory (php.runtime.memory.StringMemory)58 ForeachIterator (php.runtime.lang.ForeachIterator)47 ReferenceMemory (php.runtime.memory.ReferenceMemory)40 KeyValueMemory (php.runtime.memory.KeyValueMemory)25 Invoker (php.runtime.invoke.Invoker)21 ArrayKeyMemory (php.runtime.memory.helper.ArrayKeyMemory)21 ArrayValueMemory (php.runtime.memory.helper.ArrayValueMemory)21 ShortcutMemory (php.runtime.memory.helper.ShortcutMemory)21 Environment (php.runtime.env.Environment)20 IObject (php.runtime.lang.IObject)19 UndefinedMemory (php.runtime.memory.helper.UndefinedMemory)16 ClassEntity (php.runtime.reflection.ClassEntity)16 TraceInfo (php.runtime.env.TraceInfo)12 File (java.io.File)7 LocalVariable (org.develnext.jphp.core.compiler.jvm.misc.LocalVariable)7