Update streams tests
This commit is contained in:
parent
ddc3850722
commit
90de22b288
@ -18,104 +18,54 @@ object FriendlyStreams {
|
|||||||
fun test() {
|
fun test() {
|
||||||
val output = FastByteArrayOutputStream()
|
val output = FastByteArrayOutputStream()
|
||||||
|
|
||||||
output.writeInt(4)
|
for (i in 0 .. 65565) {
|
||||||
output.writeInt(16)
|
output.writeInt(i)
|
||||||
output.writeInt(-1)
|
}
|
||||||
output.writeInt(1000000)
|
|
||||||
|
|
||||||
output.writeVarIntLE(0)
|
for (i in 0 .. 65565) {
|
||||||
output.writeVarIntLE(1)
|
output.writeVarIntLE(i)
|
||||||
output.writeVarIntLE(4)
|
}
|
||||||
output.writeVarIntLE(15)
|
|
||||||
output.writeVarIntLE(16)
|
|
||||||
output.writeVarIntLE(127)
|
|
||||||
output.writeVarIntLE(128)
|
|
||||||
output.writeVarIntLE(129)
|
|
||||||
output.writeVarIntLE(10023)
|
|
||||||
output.writeVarIntLE(100000)
|
|
||||||
|
|
||||||
output.writeVarIntLE(-0)
|
for (i in 0 .. 65565) {
|
||||||
output.writeVarIntLE(-1)
|
output.writeVarLongLE(i.toLong())
|
||||||
output.writeVarIntLE(-4)
|
}
|
||||||
output.writeVarIntLE(-15)
|
|
||||||
output.writeVarIntLE(-16)
|
|
||||||
output.writeVarIntLE(-127)
|
|
||||||
output.writeVarIntLE(-128)
|
|
||||||
output.writeVarIntLE(-129)
|
|
||||||
output.writeVarIntLE(-10023)
|
|
||||||
output.writeVarIntLE(-100000)
|
|
||||||
|
|
||||||
output.writeVarLongLE(0)
|
for (i in 0 .. 65565) {
|
||||||
output.writeVarLongLE(1)
|
output.writeInt(-i)
|
||||||
output.writeVarLongLE(4)
|
}
|
||||||
output.writeVarLongLE(15)
|
|
||||||
output.writeVarLongLE(16)
|
|
||||||
output.writeVarLongLE(127)
|
|
||||||
output.writeVarLongLE(128)
|
|
||||||
output.writeVarLongLE(129)
|
|
||||||
output.writeVarLongLE(10023)
|
|
||||||
output.writeVarLongLE(100000)
|
|
||||||
|
|
||||||
output.writeVarLongLE(-0)
|
for (i in 0 .. 65565) {
|
||||||
output.writeVarLongLE(-1)
|
output.writeVarIntLE(-i)
|
||||||
output.writeVarLongLE(-4)
|
}
|
||||||
output.writeVarLongLE(-15)
|
|
||||||
output.writeVarLongLE(-16)
|
for (i in 0 .. 65565) {
|
||||||
output.writeVarLongLE(-127)
|
output.writeVarLongLE(-i.toLong())
|
||||||
output.writeVarLongLE(-128)
|
}
|
||||||
output.writeVarLongLE(-129)
|
|
||||||
output.writeVarLongLE(-10023)
|
|
||||||
output.writeVarLongLE(-100000)
|
|
||||||
|
|
||||||
val input = FastByteArrayInputStream(output.array, 0, output.length)
|
val input = FastByteArrayInputStream(output.array, 0, output.length)
|
||||||
|
|
||||||
assertEquals(4, input.readInt())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(16, input.readInt())
|
assertEquals(i, input.readInt())
|
||||||
assertEquals(-1, input.readInt())
|
}
|
||||||
assertEquals(1000000, input.readInt())
|
|
||||||
|
|
||||||
assertEquals(0, input.readVarIntLE())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(1, input.readVarIntLE())
|
assertEquals(i, input.readVarIntLE())
|
||||||
assertEquals(4, input.readVarIntLE())
|
}
|
||||||
assertEquals(15, input.readVarIntLE())
|
|
||||||
assertEquals(16, input.readVarIntLE())
|
|
||||||
assertEquals(127, input.readVarIntLE())
|
|
||||||
assertEquals(128, input.readVarIntLE())
|
|
||||||
assertEquals(129, input.readVarIntLE())
|
|
||||||
assertEquals(10023, input.readVarIntLE())
|
|
||||||
assertEquals(100000, input.readVarIntLE())
|
|
||||||
|
|
||||||
assertEquals(-0, input.readVarIntLE())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(-1, input.readVarIntLE())
|
assertEquals(i.toLong(), input.readVarLongLE())
|
||||||
assertEquals(-4, input.readVarIntLE())
|
}
|
||||||
assertEquals(-15, input.readVarIntLE())
|
|
||||||
assertEquals(-16, input.readVarIntLE())
|
|
||||||
assertEquals(-127, input.readVarIntLE())
|
|
||||||
assertEquals(-128, input.readVarIntLE())
|
|
||||||
assertEquals(-129, input.readVarIntLE())
|
|
||||||
assertEquals(-10023, input.readVarIntLE())
|
|
||||||
assertEquals(-100000, input.readVarIntLE())
|
|
||||||
|
|
||||||
assertEquals(0, input.readVarLongLE())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(1, input.readVarLongLE())
|
assertEquals(-i, input.readInt())
|
||||||
assertEquals(4, input.readVarLongLE())
|
}
|
||||||
assertEquals(15, input.readVarLongLE())
|
|
||||||
assertEquals(16, input.readVarLongLE())
|
|
||||||
assertEquals(127, input.readVarLongLE())
|
|
||||||
assertEquals(128, input.readVarLongLE())
|
|
||||||
assertEquals(129, input.readVarLongLE())
|
|
||||||
assertEquals(10023, input.readVarLongLE())
|
|
||||||
assertEquals(100000, input.readVarLongLE())
|
|
||||||
|
|
||||||
assertEquals(-0, input.readVarLongLE())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(-1, input.readVarLongLE())
|
assertEquals(-i, input.readVarIntLE())
|
||||||
assertEquals(-4, input.readVarLongLE())
|
}
|
||||||
assertEquals(-15, input.readVarLongLE())
|
|
||||||
assertEquals(-16, input.readVarLongLE())
|
for (i in 0 .. 65565) {
|
||||||
assertEquals(-127, input.readVarLongLE())
|
assertEquals(-i.toLong(), input.readVarLongLE())
|
||||||
assertEquals(-128, input.readVarLongLE())
|
}
|
||||||
assertEquals(-129, input.readVarLongLE())
|
|
||||||
assertEquals(-10023, input.readVarLongLE())
|
|
||||||
assertEquals(-100000, input.readVarLongLE())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user