Search in sources :

Example 36 with Memory

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

the class IncludeTest method testRequire.

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

Example 37 with Memory

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

the class LoopsTest method testDoWhile.

@Test
public void testDoWhile() {
    Memory memory = includeResource("loops/do_while.php");
    Assert.assertEquals("AAAAAAAAA", memory.toString());
}
Also used : Memory(php.runtime.Memory) Test(org.junit.Test)

Example 38 with Memory

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

the class LoopsTest method testFor.

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

Example 39 with Memory

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

the class ArrayMemoryTest method testSimple.

@Test
public void testSimple() {
    ArrayMemory memory = new ArrayMemory();
    assertEquals(Memory.Type.ARRAY, memory.type);
    assertEquals(0, memory.size());
    assertEquals(-1, memory.lastLongIndex);
    Memory mem = ArrayMemory.valueOf();
    assertTrue(mem instanceof ArrayMemory);
    assertEquals(-1, ((ArrayMemory) mem).lastLongIndex);
    assertEquals(0, ((ArrayMemory) mem).size());
}
Also used : Memory(php.runtime.Memory) Test(org.junit.Test)

Example 40 with Memory

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

the class ReferenceMemoryTest method testAssignRef.

@Test
public void testAssignRef() {
    Memory memory = new ReferenceMemory();
    ReferenceMemory ref = new ReferenceMemory(Memory.TRUE);
    memory.assign(ref);
    Assert.assertEquals(Memory.TRUE, memory.toImmutable());
    memory.assign(false);
    Assert.assertEquals(Memory.FALSE, ref.toImmutable());
    Memory memory2 = new ReferenceMemory();
    memory2.assign(memory);
    Assert.assertEquals(Memory.FALSE, memory.toImmutable());
    memory2.assign(12);
    Assert.assertEquals(12, memory.toLong());
    Assert.assertEquals(12, ref.toLong());
}
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