diff --git a/src/testMod/java/dan200/computercraft/ingame/CraftOsTest.kt b/src/testMod/java/dan200/computercraft/ingame/CraftOsTest.kt index 1419ee963..67c55ca10 100644 --- a/src/testMod/java/dan200/computercraft/ingame/CraftOsTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/CraftOsTest.kt @@ -10,5 +10,5 @@ class CraftOs_Test { * Sends a rednet message to another a computer and back again. */ @GameTest - fun Sends_basic_rednet_messages(context: GameTestHelper) = context.sequence { thenComputerOk(13) } + fun Sends_basic_rednet_messages(context: GameTestHelper) = context.sequence { thenComputerOk("main") } } diff --git a/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt b/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt index 62a6a24e9..9b4db113b 100644 --- a/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/DiskDriveTest.kt @@ -11,13 +11,13 @@ class Disk_Drive_Test { * @see [#688](https://github.com/SquidDev-CC/CC-Tweaked/issues/688) */ @GameTest - fun Audio_disk(helper: GameTestHelper) = helper.sequence { thenComputerOk(3) } + fun Audio_disk(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @GameTest fun Ejects_disk(helper: GameTestHelper) = helper.sequence { val stackAt = BlockPos(2, 2, 2) this - .thenComputerOk(4) + .thenComputerOk() .thenWaitUntil { helper.assertItemEntityPresent(Items.MUSIC_DISC_13, stackAt, 0.0) } } } diff --git a/src/testMod/java/dan200/computercraft/ingame/ModemTest.kt b/src/testMod/java/dan200/computercraft/ingame/ModemTest.kt index acc9f0bf6..5a3e417b2 100644 --- a/src/testMod/java/dan200/computercraft/ingame/ModemTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/ModemTest.kt @@ -7,19 +7,19 @@ import net.minecraft.util.math.BlockPos class Modem_Test { @GameTest - fun Have_peripherals(helper: GameTestHelper) = helper.sequence { thenComputerOk(15) } + fun Have_peripherals(helper: GameTestHelper) = helper.sequence { thenComputerOk() } @GameTest fun Gains_peripherals(helper: GameTestHelper) = helper.sequence { val position = BlockPos(2, 2, 2) this - .thenComputerOk(16, "initial") + .thenComputerOk(marker = "initial") .thenExecute { helper.setBlock(position, BlockCable.correctConnections( helper.level, helper.absolutePos(position), Registry.ModBlocks.CABLE.get().defaultBlockState().setValue(BlockCable.CABLE, true) )) } - .thenComputerOk(16) + .thenComputerOk() } } diff --git a/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt b/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt index ccf3e5938..39bb95bb3 100644 --- a/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt +++ b/src/testMod/java/dan200/computercraft/ingame/TurtleTest.kt @@ -7,7 +7,7 @@ import dan200.computercraft.ingame.api.thenComputerOk class Turtle_Test { @GameTest(timeoutTicks = TIMEOUT) - fun Unequip_refreshes_peripheral(helper: GameTestHelper) = helper.sequence { thenComputerOk(1) } + fun Unequip_refreshes_peripheral(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can sheer sheep (and drop items) @@ -15,7 +15,7 @@ class Turtle_Test { * @see [#537](https://github.com/SquidDev-CC/CC-Tweaked/issues/537) */ @GameTest(timeoutTicks = TIMEOUT) - fun Shears_sheep(helper: GameTestHelper) = helper.sequence { thenComputerOk(5) } + fun Shears_sheep(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can place lava. @@ -23,7 +23,7 @@ class Turtle_Test { * @see [#518](https://github.com/SquidDev-CC/CC-Tweaked/issues/518) */ @GameTest(timeoutTicks = TIMEOUT) - fun Place_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk(5) } + fun Place_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can place when waterlogged. @@ -31,7 +31,7 @@ class Turtle_Test { * @see [#385](https://github.com/SquidDev-CC/CC-Tweaked/issues/385) */ @GameTest(timeoutTicks = TIMEOUT) - fun Place_waterlogged(helper: GameTestHelper) = helper.sequence { thenComputerOk(7) } + fun Place_waterlogged(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can pick up lava @@ -39,7 +39,7 @@ class Turtle_Test { * @see [#297](https://github.com/SquidDev-CC/CC-Tweaked/issues/297) */ @GameTest(timeoutTicks = TIMEOUT) - fun Gather_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk(8) } + fun Gather_lava(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can hoe dirt. @@ -47,7 +47,7 @@ class Turtle_Test { * @see [#258](https://github.com/SquidDev-CC/CC-Tweaked/issues/258) */ @GameTest(timeoutTicks = TIMEOUT) - fun Hoe_dirt(helper: GameTestHelper) = helper.sequence { thenComputerOk(9) } + fun Hoe_dirt(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can place monitors @@ -55,14 +55,14 @@ class Turtle_Test { * @see [#691](https://github.com/SquidDev-CC/CC-Tweaked/issues/691) */ @GameTest(timeoutTicks = TIMEOUT) - fun Place_monitor(helper: GameTestHelper) = helper.sequence { thenComputerOk(10) } + fun Place_monitor(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can place into compostors. These are non-typical inventories, so * worth testing. */ @GameTest(timeoutTicks = TIMEOUT) - fun Use_compostors(helper: GameTestHelper) = helper.sequence { thenComputerOk(11) } + fun Use_compostors(helper: GameTestHelper) = helper.sequence { thenComputerOk() } /** * Checks turtles can be cleaned in cauldrons. @@ -70,7 +70,7 @@ class Turtle_Test { * Currently not required as turtles can no longer right-click cauldrons. */ @GameTest - fun Cleaned_with_cauldrons(helper: GameTestHelper) = helper.sequence { thenComputerOk(12) } + fun Cleaned_with_cauldrons(helper: GameTestHelper) = helper.sequence { thenComputerOk() } companion object { const val TIMEOUT = 200 diff --git a/src/testMod/java/dan200/computercraft/ingame/api/ComputerState.java b/src/testMod/java/dan200/computercraft/ingame/api/ComputerState.java index 7727fa177..f9e177780 100644 --- a/src/testMod/java/dan200/computercraft/ingame/api/ComputerState.java +++ b/src/testMod/java/dan200/computercraft/ingame/api/ComputerState.java @@ -18,13 +18,13 @@ import java.util.concurrent.ConcurrentHashMap; * Assertion state of a computer. * * @see TestAPI For the Lua interface for this. - * @see TestExtensionsKt#thenComputerOk(TestList, int, String) + * @see TestExtensionsKt#thenComputerOk(TestList, String, String) */ public class ComputerState { public static final String DONE = "DONE"; - protected static final Map lookup = new ConcurrentHashMap<>(); + protected static final Map lookup = new ConcurrentHashMap<>(); protected final Set markers = new HashSet<>(); protected String error; @@ -40,8 +40,8 @@ public class ComputerState if( error != null ) throw new RuntimeException( error ); } - public static ComputerState get( int id ) + public static ComputerState get( String label ) { - return lookup.get( id ); + return lookup.get( label ); } } diff --git a/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt b/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt index fa9256f05..8f7bd192d 100644 --- a/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt +++ b/src/testMod/java/dan200/computercraft/ingame/api/TestExtensions.kt @@ -21,13 +21,15 @@ import javax.imageio.ImageIO /** * Wait until a computer has finished running and check it is OK. */ -fun GameTestSequence.thenComputerOk(id: Int, marker: String = ComputerState.DONE): GameTestSequence = - thenWaitUntil { - val computer = ComputerState.get(id) - if (computer == null || !computer.isDone(marker)) throw GameTestAssertException("Computer #${id} has not finished yet.") +fun GameTestSequence.thenComputerOk(name: String? = null, marker: String = ComputerState.DONE): GameTestSequence { + val label = parent.testName + (if (name == null) "" else ".$name") + return this.thenWaitUntil { + val computer = ComputerState.get(label) + if (computer == null || !computer.isDone(marker)) throw GameTestAssertException("Computer '$label' has not finished yet.") }.thenExecute { - ComputerState.get(id).check(marker) + ComputerState.get(label).check(marker) } +} /** * Run a task on the client diff --git a/src/testMod/java/dan200/computercraft/ingame/mod/TestAPI.java b/src/testMod/java/dan200/computercraft/ingame/mod/TestAPI.java index 0029e4c94..5d08650b9 100644 --- a/src/testMod/java/dan200/computercraft/ingame/mod/TestAPI.java +++ b/src/testMod/java/dan200/computercraft/ingame/mod/TestAPI.java @@ -21,31 +21,39 @@ import java.util.Optional; * * Note, we extend this API within startup file of computers (see {@code cctest.lua}). * - * @see TestExtensionsKt#thenComputerOk(TestList, int, String) To check tests on the computer have passed. + * @see TestExtensionsKt#thenComputerOk(TestList, String, String) To check tests on the computer have passed. */ public class TestAPI extends ComputerState implements ILuaAPI { - private final int id; + private final IComputerSystem system; + private String label; TestAPI( IComputerSystem system ) { - id = system.getID(); + this.system = system; } @Override public void startup() { - ComputerCraft.log.info( "Computer #{} has turned on.", id ); + if( label == null ) label = system.getLabel(); + if( label == null ) + { + label = "#" + system.getID(); + ComputerCraft.log.warn( "Computer {} has no label", label ); + } + + ComputerCraft.log.info( "Computer '{}' has turned on.", label ); markers.clear(); error = null; - lookup.put( id, this ); + lookup.put( label, this ); } @Override public void shutdown() { - ComputerCraft.log.info( "Computer #{} has shut down.", id ); - if( lookup.get( id ) == this ) lookup.remove( id ); + ComputerCraft.log.info( "Computer '{}' has shut down.", label ); + if( lookup.get( label ) == this ) lookup.remove( label ); } @Override @@ -57,7 +65,7 @@ public class TestAPI extends ComputerState implements ILuaAPI @LuaFunction public final void fail( String message ) throws LuaException { - ComputerCraft.log.error( "Computer #{} failed with {}", id, message ); + ComputerCraft.log.error( "Computer '{}' failed with {}", label, message ); if( markers.contains( ComputerState.DONE ) ) throw new LuaException( "Cannot call fail/ok multiple times." ); markers.add( ComputerState.DONE ); error = message; @@ -79,6 +87,6 @@ public class TestAPI extends ComputerState implements ILuaAPI @LuaFunction public final void log( String message ) { - ComputerCraft.log.info( "[Computer #{}] {}", id, message ); + ComputerCraft.log.info( "[Computer '{}'] {}", label, message ); } } diff --git a/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java b/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java index 7e66fb998..bd729cbf2 100644 --- a/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java +++ b/src/testMod/java/dan200/computercraft/ingame/mod/TestHooks.java @@ -10,6 +10,7 @@ import net.minecraft.command.CommandSource; import net.minecraft.server.MinecraftServer; import net.minecraft.test.*; import net.minecraft.util.Rotation; +import net.minecraft.util.SharedConstants; import net.minecraft.util.math.BlockPos; import net.minecraft.world.GameRules; import net.minecraft.world.World; @@ -74,7 +75,7 @@ public class TestHooks countdown--; if( countdown == 0 && System.getProperty( "cctest.run", "false" ).equals( "true" ) ) startTests(); - TestCollection.singleton.tick(); + if( !SharedConstants.IS_RUNNING_IN_IDE ) TestCollection.singleton.tick(); if( runningTests != null && runningTests.isDone() ) finishTests(); } diff --git a/src/testMod/server-files/computers/computer/0/startup.lua b/src/testMod/server-files/computers/computer/0/startup.lua new file mode 100644 index 000000000..b0b815745 --- /dev/null +++ b/src/testMod/server-files/computers/computer/0/startup.lua @@ -0,0 +1,11 @@ +local label = os.getComputerLabel() +if label == nil then return test.fail("Label a computer to use it.") end + +local fn, err = loadfile("tests/" .. label .. ".lua", nil, _ENV) +if not fn then return test.fail(err) end + +local ok, err = pcall(fn) +if not ok then return test.fail(err) end + +print("Run " .. label) +test.ok() diff --git a/src/testMod/server-files/computers/computer/14/startup.lua b/src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.echo.lua similarity index 61% rename from src/testMod/server-files/computers/computer/14/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.echo.lua index dd81c8ecb..c7f3a2056 100644 --- a/src/testMod/server-files/computers/computer/14/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.echo.lua @@ -1,4 +1,5 @@ --- CraftOsTest.`Sends basic rednet messages` +os.getComputerID = function() return 1 end +os.computerID = os.getComputerID rednet.open("top") while true do diff --git a/src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.main.lua b/src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.main.lua new file mode 100644 index 000000000..6cc619802 --- /dev/null +++ b/src/testMod/server-files/computers/computer/0/tests/craftos_test.sends_basic_rednet_messages.main.lua @@ -0,0 +1,10 @@ +rednet.open("top") + +local id, msg +repeat + rednet.send(1, "Test msg") -- Keep sending, as other computer may not have started yet. + + id, msg = rednet.receive(nil, 1) +until id == 1 + +test.eq("Test msg", msg) diff --git a/src/testMod/server-files/computers/computer/3/startup.lua b/src/testMod/server-files/computers/computer/0/tests/disk_drive_test.audio_disk.lua similarity index 73% rename from src/testMod/server-files/computers/computer/3/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/disk_drive_test.audio_disk.lua index 3f25520f6..d48ce5fda 100644 --- a/src/testMod/server-files/computers/computer/3/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/disk_drive_test.audio_disk.lua @@ -1,5 +1,2 @@ --- DiskDriveTest.`Audio disk` - test.eq(true, disk.hasAudio("right"), "Has audio") test.eq("C418 - 13", disk.getAudioTitle("right"), "Audio title") -test.ok() diff --git a/src/testMod/server-files/computers/computer/0/tests/disk_drive_test.ejects_disk.lua b/src/testMod/server-files/computers/computer/0/tests/disk_drive_test.ejects_disk.lua new file mode 100644 index 000000000..510af2a81 --- /dev/null +++ b/src/testMod/server-files/computers/computer/0/tests/disk_drive_test.ejects_disk.lua @@ -0,0 +1 @@ +disk.eject("right") diff --git a/src/testMod/server-files/computers/computer/16/startup.lua b/src/testMod/server-files/computers/computer/0/tests/modem_test.gains_peripherals.lua similarity index 90% rename from src/testMod/server-files/computers/computer/16/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/modem_test.gains_peripherals.lua index 18022f271..d7f8559ab 100644 --- a/src/testMod/server-files/computers/computer/16/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/modem_test.gains_peripherals.lua @@ -1,5 +1,3 @@ --- Modem_test.Gains_peripherals - local function check_peripherals(expected, msg) local peripherals = peripheral.getNames() table.sort(peripherals) @@ -18,5 +16,3 @@ check_peripherals({ "monitor_1", "printer_1", }, "Gains new peripherals") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/15/startup.lua b/src/testMod/server-files/computers/computer/0/tests/modem_test.have_peripherals.lua similarity index 87% rename from src/testMod/server-files/computers/computer/15/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/modem_test.have_peripherals.lua index 5724665df..4752250d2 100644 --- a/src/testMod/server-files/computers/computer/15/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/modem_test.have_peripherals.lua @@ -1,5 +1,3 @@ --- Modem_test.Have_peripherals - local function check_peripherals(expected, msg) local peripherals = peripheral.getNames() table.sort(peripherals) @@ -12,5 +10,3 @@ check_peripherals({ "printer_0", "right", }, "Starts with peripherals") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/12/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.cleaned_with_cauldrons.lua similarity index 84% rename from src/testMod/server-files/computers/computer/12/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.cleaned_with_cauldrons.lua index 2a57104af..7041fec9b 100644 --- a/src/testMod/server-files/computers/computer/12/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.cleaned_with_cauldrons.lua @@ -1,5 +1,3 @@ --- TurtleTest.`Cleaned with cauldrons` - local old_details = turtle.getItemDetail(1, true) test.assert(turtle.place(), "Dyed turtle") @@ -7,5 +5,3 @@ test.assert(turtle.place(), "Dyed turtle") local new_details = turtle.getItemDetail(1, true) test.eq("computercraft:turtle_normal", new_details.name, "Still a turtle") test.neq(old_details.nbt, new_details.nbt, "Colour has changed") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/8/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.gather_lava.lua similarity index 82% rename from src/testMod/server-files/computers/computer/8/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.gather_lava.lua index a3c105c80..928989f45 100644 --- a/src/testMod/server-files/computers/computer/8/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.gather_lava.lua @@ -1,5 +1,3 @@ --- TurtleTest.`Gather lava` - turtle.placeDown() local item = turtle.getItemDetail() @@ -7,5 +5,3 @@ test.eq("minecraft:lava_bucket", item.name) local has_down, down = turtle.inspectDown() test.eq(false, has_down, "Air below") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/9/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.hoe_dirt.lua similarity index 81% rename from src/testMod/server-files/computers/computer/9/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.hoe_dirt.lua index 0e80cd606..51dc70576 100644 --- a/src/testMod/server-files/computers/computer/9/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.hoe_dirt.lua @@ -1,9 +1,5 @@ --- Turtle.`Hoe dirt` - test.assert(turtle.dig()) local has_block, block = turtle.inspect() test.assert(has_block, "Has block") test.eq("minecraft:farmland", block.name) - -test.ok() diff --git a/src/testMod/server-files/computers/computer/6/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_lava.lua similarity index 79% rename from src/testMod/server-files/computers/computer/6/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.place_lava.lua index 584bffdce..2ad6f9ee1 100644 --- a/src/testMod/server-files/computers/computer/6/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_lava.lua @@ -1,9 +1,5 @@ --- TurtleTest.`Lava place` - test.assert(turtle.placeDown()) local ok, down = turtle.inspectDown() test.assert(ok, "Has below") test.eq("minecraft:lava", down.name, "Is lava") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/10/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_monitor.lua similarity index 83% rename from src/testMod/server-files/computers/computer/10/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.place_monitor.lua index 81a5bb018..e5ad6f0e6 100644 --- a/src/testMod/server-files/computers/computer/10/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_monitor.lua @@ -1,10 +1,6 @@ --- 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() diff --git a/src/testMod/server-files/computers/computer/7/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_waterlogged.lua similarity index 80% rename from src/testMod/server-files/computers/computer/7/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.place_waterlogged.lua index 8f135bf73..e55dadfbc 100644 --- a/src/testMod/server-files/computers/computer/7/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.place_waterlogged.lua @@ -1,10 +1,6 @@ --- TurtleTest.`Place Waterlogged` - test.assert(turtle.place()) local has_block, block = turtle.inspect() test.eq(true, has_block, "Has block") test.eq("minecraft:oak_fence", block.name) test.eq(true, block.state.waterlogged) - -test.ok() diff --git a/src/testMod/server-files/computers/computer/5/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.shears_sheep.lua similarity index 100% rename from src/testMod/server-files/computers/computer/5/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.shears_sheep.lua diff --git a/src/testMod/server-files/computers/computer/1/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.unequip_refreshes_peripheral.lua similarity index 74% rename from src/testMod/server-files/computers/computer/1/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.unequip_refreshes_peripheral.lua index bb484e104..2814b1a44 100644 --- a/src/testMod/server-files/computers/computer/1/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.unequip_refreshes_peripheral.lua @@ -1,7 +1,3 @@ --- TurtleTest.`Unequip refreshes peripheral` - test.eq("modem", peripheral.getType("right"), "Starts with a modem") turtle.equipRight() test.eq("drive", peripheral.getType("right"), "Unequipping gives a drive") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/11/startup.lua b/src/testMod/server-files/computers/computer/0/tests/turtle_test.use_compostors.lua similarity index 59% rename from src/testMod/server-files/computers/computer/11/startup.lua rename to src/testMod/server-files/computers/computer/0/tests/turtle_test.use_compostors.lua index 58cc42004..7a5f4b52b 100644 --- a/src/testMod/server-files/computers/computer/11/startup.lua +++ b/src/testMod/server-files/computers/computer/0/tests/turtle_test.use_compostors.lua @@ -1,5 +1 @@ --- TurtleTest.`Use compostors` - test.eq(true, turtle.dropDown(), "Drop items into compostor") - -test.ok() diff --git a/src/testMod/server-files/computers/computer/13/startup.lua b/src/testMod/server-files/computers/computer/13/startup.lua deleted file mode 100644 index e8954964f..000000000 --- a/src/testMod/server-files/computers/computer/13/startup.lua +++ /dev/null @@ -1,14 +0,0 @@ --- CraftOsTest.`Sends basic rednet messages` - -rednet.open("top") - -local id, msg -repeat - rednet.send(14, "Test msg") -- Keep sending, as other computer may not have started yet. - - id, msg = rednet.receive(nil, 1) - print(id, msg) -until id == 14 - -test.eq("Test msg", msg) -test.ok() diff --git a/src/testMod/server-files/computers/computer/4/startup.lua b/src/testMod/server-files/computers/computer/4/startup.lua deleted file mode 100644 index 34214d536..000000000 --- a/src/testMod/server-files/computers/computer/4/startup.lua +++ /dev/null @@ -1,4 +0,0 @@ --- DiskDriveTest.`Ejects disk` - -disk.eject("right") -test.ok() diff --git a/src/testMod/server-files/computers/ids.json b/src/testMod/server-files/computers/ids.json index 44b297ef6..9c8f668d7 100644 --- a/src/testMod/server-files/computers/ids.json +++ b/src/testMod/server-files/computers/ids.json @@ -1,5 +1,5 @@ { - "computer": 16, + "computer": 0, "peripheral.monitor": 1, "peripheral.printer": 1 } diff --git a/src/testMod/server-files/server.properties b/src/testMod/server-files/server.properties index 46446b36a..60384302f 100644 --- a/src/testMod/server-files/server.properties +++ b/src/testMod/server-files/server.properties @@ -11,7 +11,7 @@ enforce-whitelist=false force-gamemode=false function-permission-level=2 gamemode=creative -generate-structures=true +generate-structures=false generator-settings= hardcore=false level-name=world diff --git a/src/testMod/server-files/structures/computer_test.no_through_signal.snbt b/src/testMod/server-files/structures/computer_test.no_through_signal.snbt index 1d66e7b51..11d53dabb 100644 --- a/src/testMod/server-files/structures/computer_test.no_through_signal.snbt +++ b/src/testMod/server-files/structures/computer_test.no_through_signal.snbt @@ -109,7 +109,8 @@ { nbt: { id: "computercraft:computer_advanced", - ComputerId: 2, + Label: "computer_test.no_through_signal", + ComputerId: 0, On: 1b }, pos: [2, 1, 2], diff --git a/src/testMod/server-files/structures/craftos_test.sends_basic_rednet_messages.snbt b/src/testMod/server-files/structures/craftos_test.sends_basic_rednet_messages.snbt index a6ce86eba..a59493013 100644 --- a/src/testMod/server-files/structures/craftos_test.sends_basic_rednet_messages.snbt +++ b/src/testMod/server-files/structures/craftos_test.sends_basic_rednet_messages.snbt @@ -104,9 +104,9 @@ }, { nbt: { - Label: "Echo", + Label: "craftos_test.sends_basic_rednet_messages.echo", id: "computercraft:computer_advanced", - ComputerId: 14, + ComputerId: 0, On: 1b }, pos: [1, 1, 2], @@ -114,9 +114,9 @@ }, { nbt: { - Label: "Main", + Label: "craftos_test.sends_basic_rednet_messages.main", id: "computercraft:computer_advanced", - ComputerId: 13, + ComputerId: 0, On: 1b }, pos: [3, 1, 2], diff --git a/src/testMod/server-files/structures/disk_drive_test.audio_disk.snbt b/src/testMod/server-files/structures/disk_drive_test.audio_disk.snbt index f4ccc9e0c..c3810e81f 100644 --- a/src/testMod/server-files/structures/disk_drive_test.audio_disk.snbt +++ b/src/testMod/server-files/structures/disk_drive_test.audio_disk.snbt @@ -52,7 +52,8 @@ { nbt: { id: "computercraft:computer_advanced", - ComputerId: 3, + Label: "disk_drive_test.audio_disk", + ComputerId: 0, On: 1b }, pos: [1, 1, 1], diff --git a/src/testMod/server-files/structures/disk_drive_test.ejects_disk.snbt b/src/testMod/server-files/structures/disk_drive_test.ejects_disk.snbt index 27906efe0..21a74d385 100644 --- a/src/testMod/server-files/structures/disk_drive_test.ejects_disk.snbt +++ b/src/testMod/server-files/structures/disk_drive_test.ejects_disk.snbt @@ -172,7 +172,8 @@ { nbt: { id: "computercraft:computer_advanced", - ComputerId: 4, + Label: "disk_drive_test.ejects_disk", + ComputerId: 0, On: 1b }, pos: [3, 1, 1], diff --git a/src/testMod/server-files/structures/modem_test.gains_peripherals.snbt b/src/testMod/server-files/structures/modem_test.gains_peripherals.snbt index 74700f336..3ff03cec6 100644 --- a/src/testMod/server-files/structures/modem_test.gains_peripherals.snbt +++ b/src/testMod/server-files/structures/modem_test.gains_peripherals.snbt @@ -607,7 +607,8 @@ { nbt: { id: "computercraft:computer_advanced", - ComputerId: 16, + Label: "modem_test.gains_peripherals", + ComputerId: 0, On: 1b }, pos: [4, 1, 1], diff --git a/src/testMod/server-files/structures/modem_test.have_peripherals.snbt b/src/testMod/server-files/structures/modem_test.have_peripherals.snbt index ba6eae322..1a1d2e5fb 100644 --- a/src/testMod/server-files/structures/modem_test.have_peripherals.snbt +++ b/src/testMod/server-files/structures/modem_test.have_peripherals.snbt @@ -615,7 +615,8 @@ { nbt: { id: "computercraft:computer_advanced", - ComputerId: 15, + Label: "modem_test.have_peripherals", + ComputerId: 0, On: 1b }, pos: [4, 1, 2], diff --git a/src/testMod/server-files/structures/turtle_test.cleaned_with_cauldrons.snbt b/src/testMod/server-files/structures/turtle_test.cleaned_with_cauldrons.snbt index 9b0808cb7..edb20700c 100644 --- a/src/testMod/server-files/structures/turtle_test.cleaned_with_cauldrons.snbt +++ b/src/testMod/server-files/structures/turtle_test.cleaned_with_cauldrons.snbt @@ -46,7 +46,7 @@ Name: "Dev" }, Fuel: 0, - Label: "Clean turtle", + Label: "turtle_test.cleaned_with_cauldrons", Slot: 0, Items: [ { @@ -58,12 +58,12 @@ Name: '{"text":"Clean turtle"}' }, Color: 13388876, - ComputerId: 12 + ComputerId: 0 } } ], id: "computercraft:turtle_normal", - ComputerId: 12, + ComputerId: 0, On: 1b }, pos: [1, 1, 0], diff --git a/src/testMod/server-files/structures/turtle_test.gather_lava.snbt b/src/testMod/server-files/structures/turtle_test.gather_lava.snbt index 1b51705ec..a801e031c 100644 --- a/src/testMod/server-files/structures/turtle_test.gather_lava.snbt +++ b/src/testMod/server-files/structures/turtle_test.gather_lava.snbt @@ -151,7 +151,8 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 8, + Label: "turtle_test.gather_lava", + ComputerId: 0, On: 1b }, pos: [2, 2, 2], diff --git a/src/testMod/server-files/structures/turtle_test.hoe_dirt.snbt b/src/testMod/server-files/structures/turtle_test.hoe_dirt.snbt index 559e1a6fe..b582ffad7 100644 --- a/src/testMod/server-files/structures/turtle_test.hoe_dirt.snbt +++ b/src/testMod/server-files/structures/turtle_test.hoe_dirt.snbt @@ -54,7 +54,8 @@ Slot: 0, Items: [], id: "computercraft:turtle_normal", - ComputerId: 9, + Label: "turtle_test.hoe_dirt", + ComputerId: 0, On: 1b }, pos: [1, 1, 0], diff --git a/src/testMod/server-files/structures/turtle_test.place_lava.snbt b/src/testMod/server-files/structures/turtle_test.place_lava.snbt index 22334744b..42525f747 100644 --- a/src/testMod/server-files/structures/turtle_test.place_lava.snbt +++ b/src/testMod/server-files/structures/turtle_test.place_lava.snbt @@ -151,7 +151,8 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 6, + Label: "turtle_test.place_lava", + ComputerId: 0, On: 1b }, pos: [2, 2, 2], diff --git a/src/testMod/server-files/structures/turtle_test.place_monitor.snbt b/src/testMod/server-files/structures/turtle_test.place_monitor.snbt index 966912798..36317ece4 100644 --- a/src/testMod/server-files/structures/turtle_test.place_monitor.snbt +++ b/src/testMod/server-files/structures/turtle_test.place_monitor.snbt @@ -123,7 +123,8 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 10, + Label: "turtle_test.place_monitor", + ComputerId: 0, On: 1b }, pos: [1, 1, 2], diff --git a/src/testMod/server-files/structures/turtle_test.place_waterlogged.snbt b/src/testMod/server-files/structures/turtle_test.place_waterlogged.snbt index a7930b6e0..0561834c2 100644 --- a/src/testMod/server-files/structures/turtle_test.place_waterlogged.snbt +++ b/src/testMod/server-files/structures/turtle_test.place_waterlogged.snbt @@ -159,7 +159,8 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 7, + Label: "turtle_test.place_waterlogged", + ComputerId: 0, On: 1b }, pos: [2, 1, 1], diff --git a/src/testMod/server-files/structures/turtle_test.shears_sheep.snbt b/src/testMod/server-files/structures/turtle_test.shears_sheep.snbt index dbd5ba6a6..a970f0b3d 100644 --- a/src/testMod/server-files/structures/turtle_test.shears_sheep.snbt +++ b/src/testMod/server-files/structures/turtle_test.shears_sheep.snbt @@ -287,7 +287,8 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 5, + Label: "turtle_test.shears_sheep", + ComputerId: 0, On: 1b }, pos: [2, 3, 2], diff --git a/src/testMod/server-files/structures/turtle_test.unequip_refreshes_peripheral.snbt b/src/testMod/server-files/structures/turtle_test.unequip_refreshes_peripheral.snbt index ff9613efd..9d7e02e48 100644 --- a/src/testMod/server-files/structures/turtle_test.unequip_refreshes_peripheral.snbt +++ b/src/testMod/server-files/structures/turtle_test.unequip_refreshes_peripheral.snbt @@ -118,14 +118,14 @@ }, RightUpgrade: "computercraft:wireless_modem_normal", Fuel: 0, - Label: "Unequip refreshes peripheral", + Label: "turtle_test.unequip_refreshes_peripheral", Slot: 0, Items: [], id: "computercraft:turtle_normal", RightUpgradeNbt: { active: 0b }, - ComputerId: 1, + ComputerId: 0, On: 1b }, pos: [2, 1, 2], diff --git a/src/testMod/server-files/structures/turtle_test.use_compostors.snbt b/src/testMod/server-files/structures/turtle_test.use_compostors.snbt index 6ad6889cc..1b06224fe 100644 --- a/src/testMod/server-files/structures/turtle_test.use_compostors.snbt +++ b/src/testMod/server-files/structures/turtle_test.use_compostors.snbt @@ -110,7 +110,7 @@ Name: "Dev" }, Fuel: 0, - Label: "Uses Compostors", + Label: "turtle_test.use_compostors", Slot: 0, Items: [ { @@ -120,7 +120,7 @@ } ], id: "computercraft:turtle_normal", - ComputerId: 11, + ComputerId: 0, On: 1b }, pos: [2, 2, 2],