-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update ASM + allow non object plugins + some java utility functions i…
…n Inject, Vec2i and Vec2f Signed-off-by: Seppe Volkaerts <seppevolkaerts@hotmail.com>
- Loading branch information
1 parent
767bb93
commit ccab412
Showing
10 changed files
with
148 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
proxy/src/test/kotlin/org/lanternpowered/terre/impl/protocol/ByteBufTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Terre | ||
* | ||
* Copyright (c) LanternPowered <https://www.lanternpowered.org> | ||
* Copyright (c) contributors | ||
* | ||
* This work is licensed under the terms of the MIT License (MIT). For | ||
* a copy, see 'LICENSE.txt' or <https://opensource.org/licenses/MIT>. | ||
*/ | ||
package org.lanternpowered.terre.impl.protocol | ||
|
||
import io.netty.buffer.Unpooled | ||
import org.lanternpowered.terre.impl.network.buffer.readVec2f | ||
import org.lanternpowered.terre.impl.network.buffer.readVec2i | ||
import org.lanternpowered.terre.impl.network.buffer.writeVec2f | ||
import org.lanternpowered.terre.impl.network.buffer.writeVec2i | ||
import org.lanternpowered.terre.math.Vec2f | ||
import org.lanternpowered.terre.math.Vec2i | ||
import kotlin.test.Test | ||
import kotlin.test.assertContentEquals | ||
import kotlin.test.assertEquals | ||
|
||
class ByteBufTest { | ||
|
||
@Test | ||
fun writeVec2f() { | ||
val vec = Vec2f(125.0f, 26669.016f) | ||
|
||
val expected = Unpooled.buffer() | ||
expected.writeFloatLE(vec.x) | ||
expected.writeFloatLE(vec.y) | ||
|
||
val written = Unpooled.buffer() | ||
written.writeVec2f(vec) | ||
|
||
assertContentEquals(expected.array(), written.array()) | ||
} | ||
|
||
@Test | ||
fun readVec2f() { | ||
val vec = Vec2f(125.0f, 26669.016f) | ||
|
||
val twoFloats = Unpooled.buffer() | ||
twoFloats.writeFloatLE(vec.x) | ||
twoFloats.writeFloatLE(vec.y) | ||
|
||
val read = twoFloats.readVec2f() | ||
|
||
assertEquals(vec, read) | ||
} | ||
|
||
|
||
@Test | ||
fun writeVec2i() { | ||
val vec = Vec2i(12369, -65891) | ||
|
||
val expected = Unpooled.buffer() | ||
expected.writeIntLE(vec.x) | ||
expected.writeIntLE(vec.y) | ||
|
||
val written = Unpooled.buffer() | ||
written.writeVec2i(vec) | ||
|
||
assertContentEquals(expected.array(), written.array()) | ||
} | ||
|
||
@Test | ||
fun readVec2i() { | ||
val vec = Vec2i(12369, -65891) | ||
|
||
val twoFloats = Unpooled.buffer() | ||
twoFloats.writeIntLE(vec.x) | ||
twoFloats.writeIntLE(vec.y) | ||
|
||
val read = twoFloats.readVec2i() | ||
|
||
assertEquals(vec, read) | ||
} | ||
} |