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