Search in sources :

Example 26 with MemoryARW

use of io.questdb.cairo.vm.api.MemoryARW in project questdb by bluestreak01.

the class MemoryCARWImplTest method testLongRndEven.

@Test
public void testLongRndEven() {
    try (MemoryARW mem = new MemoryCARWImpl(11, Integer.MAX_VALUE, MemoryTag.NATIVE_DEFAULT)) {
        int n = 999;
        long o = 0;
        for (int i = n; i > 0; i--) {
            mem.putLong(o, i);
            o += 8;
        }
        o = 0;
        for (int i = n; i > 0; i--) {
            assertEquals(i, mem.getLong(o));
            o += 8;
        }
    }
}
Also used : MemoryARW(io.questdb.cairo.vm.api.MemoryARW) Test(org.junit.Test)

Example 27 with MemoryARW

use of io.questdb.cairo.vm.api.MemoryARW in project questdb by bluestreak01.

the class MemoryCARWImplTest method testLong256.

@Test
public void testLong256() {
    try (MemoryARW mem = new MemoryCARWImpl(256, Integer.MAX_VALUE, MemoryTag.NATIVE_DEFAULT)) {
        mem.putLong256("0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8");
        mem.putLong256("0xEA674fdDe714fd979de3EdF0F56AA9716B898ec8");
    }
}
Also used : MemoryARW(io.questdb.cairo.vm.api.MemoryARW) Test(org.junit.Test)

Example 28 with MemoryARW

use of io.questdb.cairo.vm.api.MemoryARW in project questdb by bluestreak01.

the class MemoryCARWImplTest method testJumpTo3.

@Test
public void testJumpTo3() {
    try (MemoryARW mem = new MemoryCARWImpl(11, Integer.MAX_VALUE, MemoryTag.NATIVE_DEFAULT)) {
        mem.jumpTo(256);
        int n = 999;
        for (int i = n; i > 0; i--) {
            mem.putLong(i);
        }
        long o = 256;
        for (int i = n; i > 0; i--) {
            assertEquals(i, mem.getLong(o));
            o += 8;
        }
        mem.jumpTo(0);
        mem.jumpTo(5);
        mem.jumpTo(0);
        for (int i = n; i > 0; i--) {
            mem.putLong(i);
        }
        o = 0;
        for (int i = n; i > 0; i--) {
            assertEquals(i, mem.getLong(o));
            o += 8;
        }
    }
}
Also used : MemoryARW(io.questdb.cairo.vm.api.MemoryARW) Test(org.junit.Test)

Example 29 with MemoryARW

use of io.questdb.cairo.vm.api.MemoryARW in project questdb by bluestreak01.

the class MemoryCARWImplTest method testShort.

@Test
public void testShort() {
    try (MemoryARW mem = new MemoryCARWImpl(7, Integer.MAX_VALUE, MemoryTag.NATIVE_DEFAULT)) {
        mem.putByte((byte) 1);
        short n = 999;
        for (short i = n; i > 0; i--) {
            mem.putShort(i);
        }
        long o = 1;
        assertEquals(1, mem.getByte(0));
        for (short i = n; i > 0; i--) {
            assertEquals(i, mem.getShort(o));
            o += 2;
        }
    }
}
Also used : MemoryARW(io.questdb.cairo.vm.api.MemoryARW) Test(org.junit.Test)

Example 30 with MemoryARW

use of io.questdb.cairo.vm.api.MemoryARW in project questdb by bluestreak01.

the class MemoryCARWImplTest method testLongRndCompatibility.

@Test
public void testLongRndCompatibility() {
    long pageSize = 64;
    try (MemoryARW mem = new MemoryCARWImpl(pageSize, Integer.MAX_VALUE, MemoryTag.NATIVE_DEFAULT)) {
        mem.putLong(33, 8980980284302834L);
        mem.putLong(12, 897928374972983477L);
        assertEquals(8980980284302834L, mem.getLong(33));
        assertEquals(897928374972983477L, mem.getLong(12));
    }
}
Also used : MemoryARW(io.questdb.cairo.vm.api.MemoryARW) Test(org.junit.Test)

Aggregations

MemoryARW (io.questdb.cairo.vm.api.MemoryARW)52 Test (org.junit.Test)46 Path (io.questdb.std.str.Path)4 CairoException (io.questdb.cairo.CairoException)2 MemoryMARW (io.questdb.cairo.vm.api.MemoryMARW)2 TestBinarySequence (io.questdb.griffin.engine.TestBinarySequence)2 TestRecord (io.questdb.cairo.TestRecord)1 RecordMetadata (io.questdb.cairo.sql.RecordMetadata)1 MemoryCMRImpl (io.questdb.cairo.vm.MemoryCMRImpl)1 MemoryMA (io.questdb.cairo.vm.api.MemoryMA)1 MemoryMR (io.questdb.cairo.vm.api.MemoryMR)1 FilesFacade (io.questdb.std.FilesFacade)1 StringSink (io.questdb.std.str.StringSink)1