1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-05 01:26:20 +00:00

Add tests for transmitting via wired modems

It crashes on 1.17 right now, so worth checking!
This commit is contained in:
Jonathan Coates 2021-08-20 18:35:00 +01:00
parent 56010382fb
commit d3a5d1e314
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
4 changed files with 609 additions and 0 deletions

View File

@ -22,4 +22,10 @@ class Modem_Test {
}
.thenComputerOk()
}
/**
* Sends a modem message to another computer on the same network
*/
@GameTest
fun Transmits_messages(context: GameTestHelper) = context.sequence { thenComputerOk("receive") }
}

View File

@ -0,0 +1,10 @@
local modem = peripheral.find("modem")
modem.open(12)
local _, name, chan, reply, payload, distance = os.pullEvent("modem_message")
test.eq("left", name, "Modem name")
test.eq(12, chan, "Channel")
test.eq(34, reply, "Reply channel")
test.eq("Hello!", payload, "Payload")
test.eq(4, distance, "Distance") -- Why 4?!

View File

@ -0,0 +1,5 @@
local modem = peripheral.find("modem")
while true do
modem.transmit(12, 34, "Hello!")
sleep(1)
end

View File

@ -0,0 +1,588 @@
{
size: [5, 5, 5],
entities: [],
blocks: [
{
pos: [0, 0, 0],
state: 0
},
{
pos: [0, 0, 1],
state: 0
},
{
pos: [0, 0, 2],
state: 0
},
{
pos: [0, 0, 3],
state: 0
},
{
pos: [0, 0, 4],
state: 0
},
{
pos: [1, 0, 0],
state: 0
},
{
pos: [1, 0, 1],
state: 0
},
{
pos: [1, 0, 2],
state: 0
},
{
pos: [1, 0, 3],
state: 0
},
{
pos: [1, 0, 4],
state: 0
},
{
pos: [2, 0, 0],
state: 0
},
{
pos: [2, 0, 1],
state: 0
},
{
pos: [2, 0, 2],
state: 0
},
{
pos: [2, 0, 3],
state: 0
},
{
pos: [2, 0, 4],
state: 0
},
{
pos: [3, 0, 0],
state: 0
},
{
pos: [3, 0, 1],
state: 0
},
{
pos: [3, 0, 2],
state: 0
},
{
pos: [3, 0, 3],
state: 0
},
{
pos: [3, 0, 4],
state: 0
},
{
pos: [4, 0, 0],
state: 0
},
{
pos: [4, 0, 1],
state: 0
},
{
pos: [4, 0, 2],
state: 0
},
{
pos: [4, 0, 3],
state: 0
},
{
pos: [4, 0, 4],
state: 0
},
{
pos: [0, 1, 0],
state: 1
},
{
pos: [0, 1, 1],
state: 1
},
{
pos: [0, 1, 2],
state: 1
},
{
pos: [0, 1, 3],
state: 1
},
{
pos: [0, 1, 4],
state: 1
},
{
pos: [1, 1, 0],
state: 1
},
{
pos: [1, 1, 1],
state: 1
},
{
pos: [1, 1, 2],
state: 1
},
{
pos: [1, 1, 4],
state: 1
},
{
pos: [2, 1, 0],
state: 1
},
{
pos: [2, 1, 4],
state: 1
},
{
pos: [3, 1, 0],
state: 1
},
{
pos: [3, 1, 2],
state: 1
},
{
pos: [3, 1, 3],
state: 1
},
{
pos: [3, 1, 4],
state: 1
},
{
pos: [4, 1, 0],
state: 1
},
{
pos: [4, 1, 1],
state: 1
},
{
pos: [4, 1, 2],
state: 1
},
{
pos: [4, 1, 3],
state: 1
},
{
pos: [4, 1, 4],
state: 1
},
{
pos: [0, 2, 0],
state: 1
},
{
pos: [0, 2, 1],
state: 1
},
{
pos: [0, 2, 2],
state: 1
},
{
pos: [0, 2, 3],
state: 1
},
{
pos: [0, 2, 4],
state: 1
},
{
pos: [1, 2, 0],
state: 1
},
{
pos: [1, 2, 1],
state: 1
},
{
pos: [1, 2, 2],
state: 1
},
{
pos: [1, 2, 3],
state: 1
},
{
pos: [1, 2, 4],
state: 1
},
{
pos: [2, 2, 0],
state: 1
},
{
pos: [2, 2, 1],
state: 1
},
{
pos: [2, 2, 2],
state: 1
},
{
pos: [2, 2, 3],
state: 1
},
{
pos: [2, 2, 4],
state: 1
},
{
pos: [3, 2, 0],
state: 1
},
{
pos: [3, 2, 1],
state: 1
},
{
pos: [3, 2, 2],
state: 1
},
{
pos: [3, 2, 3],
state: 1
},
{
pos: [3, 2, 4],
state: 1
},
{
pos: [4, 2, 0],
state: 1
},
{
pos: [4, 2, 1],
state: 1
},
{
pos: [4, 2, 2],
state: 1
},
{
pos: [4, 2, 3],
state: 1
},
{
pos: [4, 2, 4],
state: 1
},
{
pos: [0, 3, 0],
state: 1
},
{
pos: [0, 3, 1],
state: 1
},
{
pos: [0, 3, 2],
state: 1
},
{
pos: [0, 3, 3],
state: 1
},
{
pos: [0, 3, 4],
state: 1
},
{
pos: [1, 3, 0],
state: 1
},
{
pos: [1, 3, 1],
state: 1
},
{
pos: [1, 3, 2],
state: 1
},
{
pos: [1, 3, 3],
state: 1
},
{
pos: [1, 3, 4],
state: 1
},
{
pos: [2, 3, 0],
state: 1
},
{
pos: [2, 3, 1],
state: 1
},
{
pos: [2, 3, 2],
state: 1
},
{
pos: [2, 3, 3],
state: 1
},
{
pos: [2, 3, 4],
state: 1
},
{
pos: [3, 3, 0],
state: 1
},
{
pos: [3, 3, 1],
state: 1
},
{
pos: [3, 3, 2],
state: 1
},
{
pos: [3, 3, 3],
state: 1
},
{
pos: [3, 3, 4],
state: 1
},
{
pos: [4, 3, 0],
state: 1
},
{
pos: [4, 3, 1],
state: 1
},
{
pos: [4, 3, 2],
state: 1
},
{
pos: [4, 3, 3],
state: 1
},
{
pos: [4, 3, 4],
state: 1
},
{
pos: [0, 4, 0],
state: 1
},
{
pos: [0, 4, 1],
state: 1
},
{
pos: [0, 4, 2],
state: 1
},
{
pos: [0, 4, 3],
state: 1
},
{
pos: [0, 4, 4],
state: 1
},
{
pos: [1, 4, 0],
state: 1
},
{
pos: [1, 4, 1],
state: 1
},
{
pos: [1, 4, 2],
state: 1
},
{
pos: [1, 4, 3],
state: 1
},
{
pos: [1, 4, 4],
state: 1
},
{
pos: [2, 4, 0],
state: 1
},
{
pos: [2, 4, 1],
state: 1
},
{
pos: [2, 4, 2],
state: 1
},
{
pos: [2, 4, 3],
state: 1
},
{
pos: [2, 4, 4],
state: 1
},
{
pos: [3, 4, 0],
state: 1
},
{
pos: [3, 4, 1],
state: 1
},
{
pos: [3, 4, 2],
state: 1
},
{
pos: [3, 4, 3],
state: 1
},
{
pos: [3, 4, 4],
state: 1
},
{
pos: [4, 4, 0],
state: 1
},
{
pos: [4, 4, 1],
state: 1
},
{
pos: [4, 4, 2],
state: 1
},
{
pos: [4, 4, 3],
state: 1
},
{
pos: [4, 4, 4],
state: 1
},
{
nbt: {
Label: "modem_test.transmits_messages.receive",
id: "computercraft:computer_advanced",
ComputerId: 0,
On: 1b
},
pos: [1, 1, 3],
state: 2
},
{
nbt: {
PeirpheralAccess: 0b,
id: "computercraft:cable"
},
pos: [2, 1, 1],
state: 3
},
{
nbt: {
PeirpheralAccess: 0b,
id: "computercraft:cable"
},
pos: [2, 1, 2],
state: 4
},
{
nbt: {
PeirpheralAccess: 0b,
id: "computercraft:cable"
},
pos: [2, 1, 3],
state: 5
},
{
nbt: {
Label: "modem_test.transmits_messages.send",
id: "computercraft:computer_advanced",
ComputerId: 0,
On: 1b
},
pos: [3, 1, 1],
state: 2
}
],
palette: [
{
Name: "minecraft:polished_andesite"
},
{
Name: "minecraft:air"
},
{
Properties: {
facing: "north",
state: "blinking"
},
Name: "computercraft:computer_advanced"
},
{
Properties: {
east: "true",
waterlogged: "false",
south: "true",
north: "false",
west: "false",
modem: "east_off",
up: "false",
cable: "true",
down: "false"
},
Name: "computercraft:cable"
},
{
Properties: {
east: "false",
waterlogged: "false",
south: "true",
north: "true",
west: "false",
modem: "none",
up: "false",
cable: "true",
down: "false"
},
Name: "computercraft:cable"
},
{
Properties: {
east: "false",
waterlogged: "false",
south: "false",
north: "true",
west: "true",
modem: "west_off",
up: "false",
cable: "true",
down: "false"
},
Name: "computercraft:cable"
}
],
DataVersion: 2586
}