Add tests for placing monitors from turtles (#691)

This commit is contained in:
Jonathan Coates 2021-05-05 21:49:25 +01:00
parent 84bac06178
commit 4e15afa254
3 changed files with 627 additions and 5 deletions

View File

@ -13,7 +13,7 @@ class TurtleTest {
*
* @see [#537](https://github.com/SquidDev-CC/CC-Tweaked/issues/537)
*/
@GameTest(required = false)
@GameTest
suspend fun `Shears sheep`(context: TestContext) = context.checkComputerOk(5)
/**
@ -21,7 +21,7 @@ class TurtleTest {
*
* @see [#518](https://github.com/SquidDev-CC/CC-Tweaked/issues/518)
*/
@GameTest(required = false)
@GameTest
suspend fun `Place lava`(context: TestContext) = context.checkComputerOk(5)
/**
@ -29,7 +29,7 @@ class TurtleTest {
*
* @see [#385](https://github.com/SquidDev-CC/CC-Tweaked/issues/385)
*/
@GameTest(required = false)
@GameTest
suspend fun `Place waterlogged`(context: TestContext) = context.checkComputerOk(7)
/**
@ -37,7 +37,7 @@ class TurtleTest {
*
* @see [#297](https://github.com/SquidDev-CC/CC-Tweaked/issues/297)
*/
@GameTest(required = false)
@GameTest
suspend fun `Gather lava`(context: TestContext) = context.checkComputerOk(8)
/**
@ -45,6 +45,14 @@ class TurtleTest {
*
* @see [#258](https://github.com/SquidDev-CC/CC-Tweaked/issues/258)
*/
@GameTest(required = false)
@GameTest
suspend fun `Hoe dirt`(context: TestContext) = context.checkComputerOk(9)
/**
* Checks turtles can place monitors
*
* @see [#691](https://github.com/SquidDev-CC/CC-Tweaked/issues/691)
*/
@GameTest
suspend fun `Place monitor`(context: TestContext) = context.checkComputerOk(10)
}

View File

@ -0,0 +1,10 @@
-- Turtle.`Place Monitor`
test.assert(turtle.place())
local has_block, block = turtle.inspect()
test.assert(has_block, "Has block")
test.eq("computercraft:monitor_advanced", block.name)
test.eq("lr", block.state.state)
test.ok()

View File

@ -0,0 +1,604 @@
{
size: [5, 5, 5],
entities: [],
blocks: [
{
pos: [0, 0, 0],
state: 0
},
{
pos: [1, 0, 0],
state: 0
},
{
pos: [2, 0, 0],
state: 0
},
{
pos: [3, 0, 0],
state: 0
},
{
pos: [4, 0, 0],
state: 0
},
{
pos: [0, 0, 1],
state: 0
},
{
pos: [1, 0, 1],
state: 0
},
{
pos: [2, 0, 1],
state: 0
},
{
pos: [3, 0, 1],
state: 0
},
{
pos: [4, 0, 1],
state: 0
},
{
pos: [0, 0, 2],
state: 0
},
{
pos: [1, 0, 2],
state: 0
},
{
pos: [2, 0, 2],
state: 0
},
{
pos: [3, 0, 2],
state: 0
},
{
pos: [4, 0, 2],
state: 0
},
{
pos: [0, 0, 3],
state: 0
},
{
pos: [1, 0, 3],
state: 0
},
{
pos: [2, 0, 3],
state: 0
},
{
pos: [3, 0, 3],
state: 0
},
{
pos: [4, 0, 3],
state: 0
},
{
pos: [0, 0, 4],
state: 0
},
{
pos: [1, 0, 4],
state: 0
},
{
pos: [2, 0, 4],
state: 0
},
{
pos: [3, 0, 4],
state: 0
},
{
pos: [4, 0, 4],
state: 0
},
{
pos: [1, 1, 4],
state: 1
},
{
nbt: {
Owner: {
UpperId: 4039158846114182220L,
LowerId: -6876936588741668278L,
Name: "Dev"
},
Fuel: 0,
Slot: 0,
Items: [
{
Slot: 0b,
id: "computercraft:monitor_advanced",
Count: 1b
}
],
id: "computercraft:turtle_normal",
ComputerId: 10,
On: 1b
},
pos: [1, 1, 2],
state: 2
},
{
nbt: {
XIndex: 0,
Height: 1,
id: "computercraft:monitor_advanced",
Width: 1,
YIndex: 0
},
pos: [0, 1, 3],
state: 3
},
{
nbt: {
XIndex: 2,
Height: 1,
id: "computercraft:monitor_advanced",
Width: 3,
YIndex: 0
},
pos: [2, 1, 3],
state: 4
},
{
nbt: {
XIndex: 1,
Height: 1,
id: "computercraft:monitor_advanced",
Width: 3,
YIndex: 0
},
pos: [3, 1, 3],
state: 5
},
{
nbt: {
XIndex: 0,
Height: 1,
id: "computercraft:monitor_advanced",
Width: 3,
YIndex: 0
},
pos: [4, 1, 3],
state: 6
},
{
pos: [0, 1, 0],
state: 7
},
{
pos: [1, 1, 0],
state: 7
},
{
pos: [2, 1, 0],
state: 7
},
{
pos: [3, 1, 0],
state: 7
},
{
pos: [4, 1, 0],
state: 7
},
{
pos: [0, 2, 0],
state: 7
},
{
pos: [1, 2, 0],
state: 7
},
{
pos: [2, 2, 0],
state: 7
},
{
pos: [3, 2, 0],
state: 7
},
{
pos: [4, 2, 0],
state: 7
},
{
pos: [0, 3, 0],
state: 7
},
{
pos: [1, 3, 0],
state: 7
},
{
pos: [2, 3, 0],
state: 7
},
{
pos: [3, 3, 0],
state: 7
},
{
pos: [4, 3, 0],
state: 7
},
{
pos: [0, 4, 0],
state: 7
},
{
pos: [1, 4, 0],
state: 7
},
{
pos: [2, 4, 0],
state: 7
},
{
pos: [3, 4, 0],
state: 7
},
{
pos: [4, 4, 0],
state: 7
},
{
pos: [0, 1, 1],
state: 7
},
{
pos: [1, 1, 1],
state: 7
},
{
pos: [2, 1, 1],
state: 7
},
{
pos: [3, 1, 1],
state: 7
},
{
pos: [4, 1, 1],
state: 7
},
{
pos: [0, 2, 1],
state: 7
},
{
pos: [1, 2, 1],
state: 7
},
{
pos: [2, 2, 1],
state: 7
},
{
pos: [3, 2, 1],
state: 7
},
{
pos: [4, 2, 1],
state: 7
},
{
pos: [0, 3, 1],
state: 7
},
{
pos: [1, 3, 1],
state: 7
},
{
pos: [2, 3, 1],
state: 7
},
{
pos: [3, 3, 1],
state: 7
},
{
pos: [4, 3, 1],
state: 7
},
{
pos: [0, 4, 1],
state: 7
},
{
pos: [1, 4, 1],
state: 7
},
{
pos: [2, 4, 1],
state: 7
},
{
pos: [3, 4, 1],
state: 7
},
{
pos: [4, 4, 1],
state: 7
},
{
pos: [0, 1, 2],
state: 7
},
{
pos: [2, 1, 2],
state: 7
},
{
pos: [3, 1, 2],
state: 7
},
{
pos: [4, 1, 2],
state: 7
},
{
pos: [0, 2, 2],
state: 7
},
{
pos: [1, 2, 2],
state: 7
},
{
pos: [2, 2, 2],
state: 7
},
{
pos: [3, 2, 2],
state: 7
},
{
pos: [4, 2, 2],
state: 7
},
{
pos: [0, 3, 2],
state: 7
},
{
pos: [1, 3, 2],
state: 7
},
{
pos: [2, 3, 2],
state: 7
},
{
pos: [3, 3, 2],
state: 7
},
{
pos: [4, 3, 2],
state: 7
},
{
pos: [0, 4, 2],
state: 7
},
{
pos: [1, 4, 2],
state: 7
},
{
pos: [2, 4, 2],
state: 7
},
{
pos: [3, 4, 2],
state: 7
},
{
pos: [4, 4, 2],
state: 7
},
{
pos: [1, 1, 3],
state: 7
},
{
pos: [0, 2, 3],
state: 7
},
{
pos: [1, 2, 3],
state: 7
},
{
pos: [2, 2, 3],
state: 7
},
{
pos: [3, 2, 3],
state: 7
},
{
pos: [4, 2, 3],
state: 7
},
{
pos: [0, 3, 3],
state: 7
},
{
pos: [1, 3, 3],
state: 7
},
{
pos: [2, 3, 3],
state: 7
},
{
pos: [3, 3, 3],
state: 7
},
{
pos: [4, 3, 3],
state: 7
},
{
pos: [0, 4, 3],
state: 7
},
{
pos: [1, 4, 3],
state: 7
},
{
pos: [2, 4, 3],
state: 7
},
{
pos: [3, 4, 3],
state: 7
},
{
pos: [4, 4, 3],
state: 7
},
{
pos: [0, 1, 4],
state: 7
},
{
pos: [2, 1, 4],
state: 7
},
{
pos: [3, 1, 4],
state: 7
},
{
pos: [4, 1, 4],
state: 7
},
{
pos: [0, 2, 4],
state: 7
},
{
pos: [1, 2, 4],
state: 7
},
{
pos: [2, 2, 4],
state: 7
},
{
pos: [3, 2, 4],
state: 7
},
{
pos: [4, 2, 4],
state: 7
},
{
pos: [0, 3, 4],
state: 7
},
{
pos: [1, 3, 4],
state: 7
},
{
pos: [2, 3, 4],
state: 7
},
{
pos: [3, 3, 4],
state: 7
},
{
pos: [4, 3, 4],
state: 7
},
{
pos: [0, 4, 4],
state: 7
},
{
pos: [1, 4, 4],
state: 7
},
{
pos: [2, 4, 4],
state: 7
},
{
pos: [3, 4, 4],
state: 7
},
{
pos: [4, 4, 4],
state: 7
}
],
palette: [
{
Name: "minecraft:polished_andesite"
},
{
Name: "minecraft:dark_oak_planks"
},
{
Properties: {
waterlogged: "false",
facing: "south"
},
Name: "computercraft:turtle_normal"
},
{
Properties: {
orientation: "north",
facing: "north",
state: "none"
},
Name: "computercraft:monitor_advanced"
},
{
Properties: {
orientation: "north",
facing: "north",
state: "l"
},
Name: "computercraft:monitor_advanced"
},
{
Properties: {
orientation: "north",
facing: "north",
state: "lr"
},
Name: "computercraft:monitor_advanced"
},
{
Properties: {
orientation: "north",
facing: "north",
state: "r"
},
Name: "computercraft:monitor_advanced"
},
{
Name: "minecraft:air"
}
],
DataVersion: 2230
}