1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-25 22:53:22 +00:00
CC-Tweaked/src/test/java/dan200/computercraft/ingame/ComputerTest.kt
Jonathan Coates eaa7359c8c Add a whole bunch of tests
Coverage graph goes woosh. Hopefully.

More importantly, all of these are historic regressions, so very much
worth tracking.
2021-01-19 20:02:45 +00:00

28 lines
912 B
Kotlin

package dan200.computercraft.ingame
import dan200.computercraft.ingame.api.*
import net.minecraft.block.LeverBlock
import net.minecraft.block.RedstoneLampBlock
import net.minecraft.util.math.BlockPos
import org.junit.jupiter.api.Assertions.assertFalse
class ComputerTest {
/**
* Ensures redstone signals do not travel through computers.
*
* @see [#548](https://github.com/SquidDev-CC/CC-Tweaked/issues/548)
*/
@GameTest
suspend fun `No through signal`(context: TestContext) {
val lamp = BlockPos(2, 0, 4)
val lever = BlockPos(2, 0, 0)
assertFalse(context.getBlock(lamp).getValue(RedstoneLampBlock.LIT), "Lamp should not be lit")
context.modifyBlock(lever) { x -> x.setValue(LeverBlock.POWERED, true) }
context.sleep(3)
assertFalse(context.getBlock(lamp).getValue(RedstoneLampBlock.LIT), "Lamp should still not be lit")
}
}