diff --git a/Makefile b/Makefile index c1bbf1c..7b02c9e 100644 --- a/Makefile +++ b/Makefile @@ -24,5 +24,5 @@ format: .PHONY: spec spec: format - ./crystal spec --warnings all --error-on-warnings + ./crystal spec --no-debug --warnings all --error-on-warnings diff --git a/spec/expansion_spec.cr b/spec/expansion_spec.cr index 5ed968c..e323584 100644 --- a/spec/expansion_spec.cr +++ b/spec/expansion_spec.cr @@ -1,4 +1,4 @@ -require "spec" +require "./spec_helper" require "./../src/map" require "./../src/queue" diff --git a/spec/queue_spec.cr b/spec/queue_spec.cr index 687b582..cae01c6 100644 --- a/spec/queue_spec.cr +++ b/spec/queue_spec.cr @@ -1,4 +1,4 @@ -require "spec" +require "./spec_helper" require "./../src/queue" require "./../src/command" diff --git a/spec/world_spec.cr b/spec/world_spec.cr new file mode 100644 index 0000000..176a1bc --- /dev/null +++ b/spec/world_spec.cr @@ -0,0 +1,13 @@ +require "./spec_helper" +require "../src/world" + +describe "World" do + it "should build crystal harvester" do + world = World.new + point = Point.new(2, 3) + cmd = BuildCrystalHarvesterCommand.new(point) + world.push(cmd) + world.run(100) + world.map.get(point).has_role(TileRole::CrystalHarvester) + end +end diff --git a/src/world.cr b/src/world.cr index adc83c1..79e84bd 100644 --- a/src/world.cr +++ b/src/world.cr @@ -1,3 +1,5 @@ +require "./resources" + class World property ts : Int32 @@ -15,7 +17,6 @@ class World def push(command : Command) dur = command.start(self) done_at = @ts + dur - printf "world : %d : plan `%s` at %d\n", @ts, typeof(command), done_at @tasks.push(done_at, command) end @@ -28,7 +29,6 @@ class World command = item.command @ts = item.ts command.finish(self) - printf "world : %d : finish `%s`\n", @ts, typeof(command) end end end