|
|
@ -2,6 +2,7 @@ package org.openrs2.cache |
|
|
|
|
|
|
|
|
|
|
|
import io.netty.buffer.ByteBufAllocator |
|
|
|
import io.netty.buffer.ByteBufAllocator |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
|
|
|
|
import org.junit.jupiter.api.assertThrows |
|
|
|
import org.openrs2.buffer.use |
|
|
|
import org.openrs2.buffer.use |
|
|
|
import java.nio.file.Path |
|
|
|
import java.nio.file.Path |
|
|
|
import kotlin.test.Test |
|
|
|
import kotlin.test.Test |
|
|
@ -61,6 +62,12 @@ object Js5MasterIndexTest { |
|
|
|
val index = Js5MasterIndex.read(buf, MasterIndexFormat.ORIGINAL) |
|
|
|
val index = Js5MasterIndex.read(buf, MasterIndexFormat.ORIGINAL) |
|
|
|
assertEquals(decodedOriginal, index) |
|
|
|
assertEquals(decodedOriginal, index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThrows<IllegalArgumentException> { |
|
|
|
|
|
|
|
Unpooled.wrappedBuffer(byteArrayOf(0)).use { buf -> |
|
|
|
|
|
|
|
Js5MasterIndex.read(buf, MasterIndexFormat.ORIGINAL) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
@ -80,6 +87,12 @@ object Js5MasterIndexTest { |
|
|
|
val index = Js5MasterIndex.read(buf, MasterIndexFormat.VERSIONED) |
|
|
|
val index = Js5MasterIndex.read(buf, MasterIndexFormat.VERSIONED) |
|
|
|
assertEquals(decodedVersioned, index) |
|
|
|
assertEquals(decodedVersioned, index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThrows<IllegalArgumentException> { |
|
|
|
|
|
|
|
Unpooled.wrappedBuffer(byteArrayOf(0, 0, 0, 0)).use { buf -> |
|
|
|
|
|
|
|
Js5MasterIndex.read(buf, MasterIndexFormat.VERSIONED) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|