Skip to content

Commit 1a9c2f0

Browse files
committed
further testing
1 parent bd9c6df commit 1a9c2f0

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

miningClientSmall.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,5 @@ local function main()
7373
end
7474

7575
main()
76+
77+
shell.run("gps", "host", x, y, z)

tests/test_spec.lua

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,19 @@ local function createPoints(turtle, distance, areaSize)
7474
end
7575
return pointTable
7676
end
77+
78+
local function countblocks(blockName)
79+
local count = 0
80+
local lastBlock
81+
for _, block in pairs(turtleEmulator.blocks) do
82+
if block.item.name == blockName then
83+
count = count + 1
84+
lastBlock = block
85+
end
86+
end
87+
return count
88+
end
89+
7790
local function beforeEach()
7891
local geoScannerItem = {
7992
name = "advancedperipherals:geo_scanner",
@@ -127,6 +140,7 @@ local function beforeEach()
127140
end
128141

129142

143+
130144
describe("empty World", function()
131145
before_each(function()
132146
beforeEach()
@@ -160,18 +174,10 @@ describe("World with ores", function()
160174
---@cast geoScannerPeripheral GeoScanner
161175
geoScannerPeripheral.scanEmulator = true
162176
miningClient.scanStartFacingTo = "X"
177+
assert.are.equal(15, countblocks("minecraft:deepslate_iron_ore"))
163178
miningClient:main(createPoints(turtle, 2, 1))
164-
local count = 0
165-
local dirt
166-
for _, block in pairs(turtleEmulator.blocks) do
167-
if block.item.name == "minecraft:deepslate_iron_ore" then
168-
count = count + 1
169-
elseif block.item.name == "minecraft:dirt" then
170-
dirt = block
171-
else
172-
error("unknown block found")
173-
end
174-
end
179+
local count = countblocks("minecraft:deepslate_iron_ore")
180+
local dirt = countblocks("minecraft:dirt")
175181
assert.are.equal(0, count)
176182
assert.are.equal(Vector.new(0, 0, 0), turtle.position)
177183
assert.are.equal(Vector.new(1, 0, 0), turtle.facing)

0 commit comments

Comments
 (0)