Skip to content

Commit

Permalink
✅ Add tests for the id module
Browse files Browse the repository at this point in the history
  • Loading branch information
aksiome committed Mar 22, 2024
1 parent 661a166 commit a94d25c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions datapacks/Bookshelf/data/bs.id/tests/update_cuids.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Updating cuids always returns a continuous chain
# @batch bs.id

execute summon minecraft:marker run function #bs.id:give_cuid
execute summon minecraft:armor_stand run function #bs.id:give_cuid
execute summon minecraft:armor_stand run function #bs.id:give_cuid
execute summon minecraft:marker run function #bs.id:give_cuid
execute summon minecraft:marker run function #bs.id:give_cuid
execute summon minecraft:armor_stand run function #bs.id:give_cuid
execute summon minecraft:marker run function #bs.id:give_cuid
kill @e[type=minecraft:armor_stand,distance=..1]

function #bs.id:update_cuids
scoreboard players set #packtest.i bs.data 0
execute store result score #packtest bs.data run scoreboard players operation #packtest.i bs.data > @e bs.cid
execute as @e[type=minecraft:marker] if score @s bs.cid = #packtest.i bs.data run scoreboard players remove #packtest.i bs.data 1
execute as @e[type=minecraft:marker] if score @s bs.cid = #packtest.i bs.data run scoreboard players remove #packtest.i bs.data 1
execute as @e[type=minecraft:marker] if score @s bs.cid = #packtest.i bs.data run scoreboard players remove #packtest.i bs.data 1
execute as @e[type=minecraft:marker] if score @s bs.cid = #packtest.i bs.data run scoreboard players remove #packtest.i bs.data 1
scoreboard players operation #packtest bs.data -= #packtest.i bs.data
kill @e[type=minecraft:marker,distance=..1]
assert score #packtest bs.data matches 4

0 comments on commit a94d25c

Please sign in to comment.