<commit_before>package org.mapdb.store

import io.kotlintest.shouldBe
import org.eclipse.collections.impl.list.mutable.primitive.LongArrayList
import org.eclipse.collections.impl.map.mutable.primitive.LongObjectHashMap
import org.junit.Assert.*
import org.junit.Test
import org.mapdb.DBException
import org.mapdb.TT
import org.mapdb.io.DataIO
import org.mapdb.io.DataInput2
import org.mapdb.io.DataOutput2
import org.mapdb.ser.Serializer
import org.mapdb.ser.Serializers
import org.mapdb.ser.Serializers.LONG
import java.util.*
import java.util.concurrent.atomic.AtomicLong



class HeapBufStoreTest : StoreTest() {
    override fun openStore() = HeapBufStore()
}
class HeapBufStoreRWLockTest : StoreTest() {
    override fun openStore() = HeapBufStoreRWLock()
}



class ConcMapStoreTest : StoreTest() {
    override fun openStore() = ConcMapStore()

    override fun recid_getAll_sorted(){
        //TODO support multiform store
    }

}



/**
 * Tests contract on `Store` interface
 */
abstract class StoreTest {

    abstract fun openStore(): Store

    @Test fun put_get() {
        val e = openStore()
        val l = 11231203099090L
        val recid = e.put(l, LONG)
        assertEquals(l, e.get(recid, LONG))
        e.verify()
        e.close()
    }

    @Test fun put_get_large() {
        val e = openStore()
        val b = TT.randomByteArray(1000000)
        Random().nextBytes(b)<commit_msg>LiStore<commit_after>package org.mapdb.store

import io.kotlintest.shouldBe
import org.eclipse.collections.impl.list.mutable.primitive.LongArrayList
import org.eclipse.collections.impl.map.mutable.primitive.LongObjectHashMap
import org.junit.Assert.*
import org.junit.Test
import org.mapdb.DBException
import org.mapdb.TT
import org.mapdb.io.DataIO
import org.mapdb.io.DataInput2
import org.mapdb.io.DataOutput2
import org.mapdb.ser.Serializer
import org.mapdb.ser.Serializers
import org.mapdb.ser.Serializers.LONG
import java.util.*
import java.util.concurrent.atomic.AtomicLong



class HeapBufStoreTest : StoreTest() {
    override fun openStore() = HeapBufStore()
}
class HeapBufStoreRWLockTest : StoreTest() {
    override fun openStore() = HeapBufStoreRWLock()
}



class ConcMapStoreTest : StoreTest() {
    override fun openStore() = ConcMapStore()

    override fun recid_getAll_sorted(){
        //TODO support multiform store
    }

}

class LiStoreTest : StoreTest() {
    override fun openStore() = LiStore()
}



/**
 * Tests contract on `Store` interface
 */
abstract class StoreTest {

    abstract fun openStore(): Store

    @Test fun put_get() {
        val e = openStore()
        val l = 11231203099090L
        val recid = e.put(l, LONG)
        assertEquals(l, e.get(recid, LONG))
        e.verify()
        e.close()
    }

    @Test fun put_get_large() {
        val e = openStore()
        val b = TT.randomByteArray(1000000)
        Random().nextBytes(b)
{'fraction_non_alphanumeric': 0.10588235294117647, 'fraction_numerical': 0.01591695501730104, 'mean_word_length': 3.4137404580152673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '922105', 'n_tokens_mistral': 972, 'n_tokens_neox': 920, 'n_words': 206}