zombie-chaser 0.0.3 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +22 -0
- data/README.txt +57 -47
- data/Rakefile +26 -24
- data/bin/zombie-chaser +77 -79
- data/lib/{chaser.rb → zombie-chaser/chaser.rb} +392 -373
- data/lib/zombie-chaser/human.rb +312 -0
- data/{ui → lib/zombie-chaser}/icons/death.png +0 -0
- data/{ui → lib/zombie-chaser}/icons/robot.png +0 -0
- data/lib/zombie-chaser/interface.rb +153 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-attacking.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-dead.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-dying.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-idle.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-moving.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/robot-turning.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/tank-attacking.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/tank-dead.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/tank-idle.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/tank-moving.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/tank-turning.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/witch-attacking.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/witch-dead.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/witch-idle.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/witch-moving.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/witch-turning.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-attacking.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-dead.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-dying.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-idle.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-moving.png +0 -0
- data/{ui → lib/zombie-chaser}/sprites/zombie-turning.png +0 -0
- data/lib/zombie-chaser/test_unit_handler.rb +78 -0
- data/{ui → lib/zombie-chaser}/tiles/grass.png +0 -0
- data/{ui → lib/zombie-chaser}/tiles/shrubbery.png +0 -0
- data/{ui → lib/zombie-chaser}/ui.rb +165 -127
- data/lib/{world.rb → zombie-chaser/world.rb} +105 -98
- data/lib/zombie-chaser/zombie_test_chaser.rb +139 -0
- data/test/fixtures/chased.rb +56 -56
- data/test/integration.rb +58 -0
- data/test/test_chaser.rb +150 -144
- data/test/test_unit.rb +2 -2
- data/test/test_zombie.rb +302 -108
- data/zombie-chaser.gemspec +88 -88
- metadata +40 -46
- data/lib/human.rb +0 -189
- data/lib/interface.rb +0 -86
- data/lib/test_unit_handler.rb +0 -43
- data/lib/zombie_test_chaser.rb +0 -133
    
        data/test/test_unit.rb
    CHANGED
    
    | @@ -1,2 +1,2 @@ | |
| 1 | 
            -
            require " | 
| 2 | 
            -
            require " | 
| 1 | 
            +
            require "test_chaser.rb"
         | 
| 2 | 
            +
            require "test_zombie.rb"
         | 
    
        data/test/test_zombie.rb
    CHANGED
    
    | @@ -1,108 +1,302 @@ | |
| 1 | 
            -
             | 
| 2 | 
            -
             | 
| 3 | 
            -
            require " | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
                 | 
| 9 | 
            -
                actual_representations  | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
                 | 
| 23 | 
            -
                 | 
| 24 | 
            -
             | 
| 25 | 
            -
             | 
| 26 | 
            -
            end
         | 
| 27 | 
            -
             | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
             | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
                 | 
| 48 | 
            -
                 | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
               | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
                 | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
             | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
                 | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
            end
         | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
                 | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
             | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 91 | 
            -
                 | 
| 92 | 
            -
                 | 
| 93 | 
            -
              end
         | 
| 94 | 
            -
             | 
| 95 | 
            -
             | 
| 96 | 
            -
             | 
| 97 | 
            -
             | 
| 98 | 
            -
             | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
                 | 
| 102 | 
            -
                 | 
| 103 | 
            -
             | 
| 104 | 
            -
             | 
| 105 | 
            -
             | 
| 106 | 
            -
             | 
| 107 | 
            -
             | 
| 108 | 
            -
             | 
| 1 | 
            +
            require "test/unit"
         | 
| 2 | 
            +
            require "zombie-chaser/world"
         | 
| 3 | 
            +
            require "timeout"
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module TestHumanHelper
         | 
| 6 | 
            +
              def assert_that_representations_include(expected_representation, human_results, failure_message)
         | 
| 7 | 
            +
                world = create_world(human_results)
         | 
| 8 | 
            +
                actual_representations = world.interface.representations
         | 
| 9 | 
            +
                assert actual_representations.include?(expected_representation), failure_message + "Expected #{expected_representation}, got #{actual_representations.inspect}"
         | 
| 10 | 
            +
              end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
              def assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 13 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 14 | 
            +
                actual_representations = world.interface.representations
         | 
| 15 | 
            +
                expected_representations.each do |expected_representation|
         | 
| 16 | 
            +
                  assert actual_representations.include?(expected_representation), failure_message + ": Expected #{expected_representation}, got #{actual_representations.inspect}"
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def assert_adjusted_width_representations_include_representations(expected_representations, human_results, zombies_results, console_width, failure_message)
         | 
| 21 | 
            +
                world = create_world_with_set_console_width(human_results, zombies_results, console_width)
         | 
| 22 | 
            +
                actual_representations = world.interface.representations
         | 
| 23 | 
            +
                expected_representations.each do |expected_representation|
         | 
| 24 | 
            +
                  assert actual_representations.include?(expected_representation), failure_message + ": Expected #{expected_representation}, got #{actual_representations.inspect}"
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              def assert_that_representations_do_not_include(unexpected_representation, human_results, zombies_results, failure_message)
         | 
| 29 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 30 | 
            +
                actual_representations = world.interface.representations
         | 
| 31 | 
            +
                assert_equal false, actual_representations.include?(unexpected_representation), failure_message + ": Didn't expect #{unexpected_representation}, got #{actual_representations.inspect}"
         | 
| 32 | 
            +
              end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
              def assert_that_representations_include_regexp_match(expected_regexp, human_results, zombies_results, failure_message)
         | 
| 35 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 36 | 
            +
                actual_representations = world.interface.representations
         | 
| 37 | 
            +
                assert actual_representations.any?{|actual_representation| actual_representation =~ expected_regexp}, failure_message + ": Expected #{expected_regexp.inspect} would match something in #{actual_representations.inspect}"
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
              def assert_that_representations_do_not_include_regexp_match(unexpected_regexp, human_results, zombies_results, failure_message)
         | 
| 41 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 42 | 
            +
                actual_representations = world.interface.representations
         | 
| 43 | 
            +
                assert_equal false, actual_representations.any?{|actual_representation| puts actual_representation if actual_representation =~ unexpected_regexp; actual_representation =~ unexpected_regexp}, failure_message + ": Didn't expect #{unexpected_regexp.inspect} would match something in #{actual_representations.inspect}"
         | 
| 44 | 
            +
              end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              def assert_that_human_deadness_is(human_expected_to_die, human_results, zombies_results, failure_message)
         | 
| 47 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 48 | 
            +
                assert_equal human_expected_to_die, world.human_dead?, failure_message
         | 
| 49 | 
            +
              end
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              def assert_that_counts_are(expected_counts, human_results, zombies_results, failure_message)
         | 
| 52 | 
            +
                world = World.new_using_results(human_results, zombies_results)
         | 
| 53 | 
            +
                actual_counts = Hash.new(0)
         | 
| 54 | 
            +
                world.while_world_running do
         | 
| 55 | 
            +
                  assert world.run_human, "Human unexpectedly died"
         | 
| 56 | 
            +
                  zombies_results.size.times do
         | 
| 57 | 
            +
                    begin
         | 
| 58 | 
            +
                      # Chaser#validate returns true if chaser-proof, and false if mutations to it still pass its unit tests
         | 
| 59 | 
            +
                      # Hence the "not" in the next line
         | 
| 60 | 
            +
                      result = (not world.run_next_zombie)
         | 
| 61 | 
            +
                    rescue Timeout::Error
         | 
| 62 | 
            +
                      result = true
         | 
| 63 | 
            +
                    end
         | 
| 64 | 
            +
                    actual_counts[result] += 1
         | 
| 65 | 
            +
                  end
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
                assert_equal expected_counts, actual_counts, failure_message
         | 
| 68 | 
            +
              end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
              def assert_does_not_deadlock(human_results, zombies_results, failure_message)
         | 
| 71 | 
            +
                assert_nothing_raised(failure_message) do
         | 
| 72 | 
            +
                  timeout(1) do
         | 
| 73 | 
            +
                    world = create_world(human_results, zombies_results)
         | 
| 74 | 
            +
                  end
         | 
| 75 | 
            +
                end
         | 
| 76 | 
            +
              end
         | 
| 77 | 
            +
             | 
| 78 | 
            +
              def create_world(human_results, zombies_results = [])
         | 
| 79 | 
            +
                world = World.new_using_results(human_results, zombies_results)
         | 
| 80 | 
            +
                world.while_world_running do
         | 
| 81 | 
            +
                  human_survives = world.run_human
         | 
| 82 | 
            +
                  if human_survives
         | 
| 83 | 
            +
                    zombies_results.size.times do
         | 
| 84 | 
            +
                      begin
         | 
| 85 | 
            +
                        world.run_next_zombie
         | 
| 86 | 
            +
                      rescue Timeout::Error
         | 
| 87 | 
            +
                        #Don't worry about it
         | 
| 88 | 
            +
                      end
         | 
| 89 | 
            +
                    end
         | 
| 90 | 
            +
                  end
         | 
| 91 | 
            +
                end
         | 
| 92 | 
            +
                world
         | 
| 93 | 
            +
              end
         | 
| 94 | 
            +
            end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            class TestHuman < Test::Unit::TestCase
         | 
| 97 | 
            +
              include TestHumanHelper
         | 
| 98 | 
            +
             | 
| 99 | 
            +
              def test_human_single_success
         | 
| 100 | 
            +
                human_results = [:pass]
         | 
| 101 | 
            +
                failure_message = "Can't handle single success"
         | 
| 102 | 
            +
                assert_that_representations_include(".@", human_results, failure_message)
         | 
| 103 | 
            +
              end
         | 
| 104 | 
            +
             | 
| 105 | 
            +
              def test_human_single_failure
         | 
| 106 | 
            +
                human_results = [:failure]
         | 
| 107 | 
            +
                failure_message = "Can't handle single failure"
         | 
| 108 | 
            +
                assert_that_representations_include("+", human_results, failure_message)
         | 
| 109 | 
            +
              end
         | 
| 110 | 
            +
             | 
| 111 | 
            +
              def test_human_two_successes
         | 
| 112 | 
            +
                human_results = [:pass, :pass]
         | 
| 113 | 
            +
                expected_representations = ["@", ".@", "..@"]
         | 
| 114 | 
            +
                failure_message = "Needs to be able to do multiple steps"
         | 
| 115 | 
            +
                #This'll run the simulation three times. Optimize if neccessary (it isn't yet)
         | 
| 116 | 
            +
                expected_representations.each do |expected_representation|
         | 
| 117 | 
            +
                  assert_that_representations_include(expected_representation, human_results, failure_message)
         | 
| 118 | 
            +
                end
         | 
| 119 | 
            +
              end
         | 
| 120 | 
            +
             | 
| 121 | 
            +
              def test_human_success_failure
         | 
| 122 | 
            +
                human_results = [:pass, :failure]
         | 
| 123 | 
            +
                expected_representation = ".+"
         | 
| 124 | 
            +
                failure_message = "Can't handle success and failure"
         | 
| 125 | 
            +
                assert_that_representations_include(expected_representation, human_results, failure_message)
         | 
| 126 | 
            +
              end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
              def test_human_success_failure_success
         | 
| 129 | 
            +
                human_results = [:pass, :failure, :pass]
         | 
| 130 | 
            +
                expected_representation = ".+"
         | 
| 131 | 
            +
                failure_message = "Can't handle success and failure"
         | 
| 132 | 
            +
                assert_that_representations_include(expected_representation, human_results, failure_message)
         | 
| 133 | 
            +
              end
         | 
| 134 | 
            +
             | 
| 135 | 
            +
              def test_human_exploding
         | 
| 136 | 
            +
                human_results = [:pass, :failure]
         | 
| 137 | 
            +
                expected_representation = ".*"
         | 
| 138 | 
            +
                failure_message = "Doesn't represent the human exploding"
         | 
| 139 | 
            +
                assert_that_representations_include(expected_representation, human_results, failure_message)
         | 
| 140 | 
            +
              end
         | 
| 141 | 
            +
             | 
| 142 | 
            +
            end
         | 
| 143 | 
            +
             | 
| 144 | 
            +
            class TestZombie < Test::Unit::TestCase
         | 
| 145 | 
            +
              include TestHumanHelper
         | 
| 146 | 
            +
             | 
| 147 | 
            +
              def test_human_surviving_zombie_slaying
         | 
| 148 | 
            +
                human_results = [:pass, :pass]
         | 
| 149 | 
            +
                zombies_results = [[:failure]]
         | 
| 150 | 
            +
                expected_representations = ["..@", "*.@"]
         | 
| 151 | 
            +
                failure_message = "Can't represent a zombie slaying."
         | 
| 152 | 
            +
                assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 153 | 
            +
              end
         | 
| 154 | 
            +
             | 
| 155 | 
            +
              def test_human_surviving_zombie_slaying2
         | 
| 156 | 
            +
                human_results = [:pass, :pass, :pass]
         | 
| 157 | 
            +
                zombies_results = [[:pass, :failure]]
         | 
| 158 | 
            +
                expected_representations = ["...@", "Z..@", ".*.@"]
         | 
| 159 | 
            +
                failure_message = "Can't represent a zombie slaying."
         | 
| 160 | 
            +
                assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 161 | 
            +
              end
         | 
| 162 | 
            +
             | 
| 163 | 
            +
              #Describes existing behaviour, but added to ensure a future commit works properly
         | 
| 164 | 
            +
              def test_zombies_dont_appear_if_human_doesnt_survive_unit_tests
         | 
| 165 | 
            +
                human_results = [:pass, :failure]
         | 
| 166 | 
            +
                zombies_results = [[:pass, :failure]]
         | 
| 167 | 
            +
                unexpected_representation = "Z+"
         | 
| 168 | 
            +
                failure_message = "Doesn't stop after failed unmutated unit tests"
         | 
| 169 | 
            +
                assert_that_representations_do_not_include(unexpected_representation, human_results, zombies_results, failure_message)
         | 
| 170 | 
            +
              end
         | 
| 171 | 
            +
             | 
| 172 | 
            +
              def test_corpse_littered_landscape
         | 
| 173 | 
            +
                human_results = [:pass, :pass, :pass]
         | 
| 174 | 
            +
                zombies_results = [[:pass, :failure],[:failure]]
         | 
| 175 | 
            +
                expected_representations = ["++.@"]
         | 
| 176 | 
            +
                failure_message = "Can't display a corpse littered landscape"
         | 
| 177 | 
            +
                assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 178 | 
            +
              end
         | 
| 179 | 
            +
             | 
| 180 | 
            +
              def test_multiple_living_zombies_visible
         | 
| 181 | 
            +
                human_results = [:pass] * 10
         | 
| 182 | 
            +
                zombies_results = [[:pass]* 8 + [:failure]] * 5
         | 
| 183 | 
            +
                expected_regexp = /ZZ/
         | 
| 184 | 
            +
                failure_message = "Can't display multiple zombies at once"
         | 
| 185 | 
            +
                assert_that_representations_include_regexp_match(expected_regexp, human_results, zombies_results, failure_message)
         | 
| 186 | 
            +
              end
         | 
| 187 | 
            +
             | 
| 188 | 
            +
              def test_timeouts_in_test_dont_cause_frozen_zombies
         | 
| 189 | 
            +
                human_results = [:pass]
         | 
| 190 | 
            +
                zombies_results = [[:timeout]]
         | 
| 191 | 
            +
                failure_message = "Doesn't handle timeouts"
         | 
| 192 | 
            +
                assert_does_not_deadlock(human_results, zombies_results, failure_message)
         | 
| 193 | 
            +
              end
         | 
| 194 | 
            +
            end
         | 
| 195 | 
            +
             | 
| 196 | 
            +
            class TestConsoleInterface < Test::Unit::TestCase
         | 
| 197 | 
            +
              include TestHumanHelper
         | 
| 198 | 
            +
             | 
| 199 | 
            +
              #Put inside of this test case so that only things with this test case's teardown can use it
         | 
| 200 | 
            +
              def create_world_with_set_console_width(human_results, zombies_results, width)
         | 
| 201 | 
            +
                ConsoleInterface.width = width
         | 
| 202 | 
            +
                world = create_world(human_results, zombies_results)
         | 
| 203 | 
            +
                world
         | 
| 204 | 
            +
              end
         | 
| 205 | 
            +
             | 
| 206 | 
            +
              def test_excessive_tests_dont_make_it_run_off_the_page
         | 
| 207 | 
            +
                human_results = [:pass] * 500
         | 
| 208 | 
            +
                zombies_results = [[:pass, :failure]]
         | 
| 209 | 
            +
                expected_representations = ["Z" + "." * 77 + "@"] #Having 80 characters in a line doesn't work
         | 
| 210 | 
            +
                failure_message = "Doesn't handle large number of tests properly"
         | 
| 211 | 
            +
                assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 212 | 
            +
              end
         | 
| 213 | 
            +
             | 
| 214 | 
            +
              def test_console_width_configurable
         | 
| 215 | 
            +
                human_results = [:pass] * 500
         | 
| 216 | 
            +
                zombies_results = [[:pass, :failure]]
         | 
| 217 | 
            +
                console_width = 11
         | 
| 218 | 
            +
                expected_representations = ["Z" + "." * 9 + "@"]
         | 
| 219 | 
            +
                failure_message = "Doesn't allow console width to be configurable"
         | 
| 220 | 
            +
                assert_adjusted_width_representations_include_representations(expected_representations, human_results, zombies_results, console_width, failure_message)
         | 
| 221 | 
            +
              end
         | 
| 222 | 
            +
             | 
| 223 | 
            +
              def test_zombies_do_not_trample_non_dead_zombies
         | 
| 224 | 
            +
                human_results = [:pass, :pass]
         | 
| 225 | 
            +
                zombies_results = [[:pass, :failure], [:pass, :pass]]
         | 
| 226 | 
            +
                expected_representations = ["Z*@", "Z+@"]
         | 
| 227 | 
            +
                failure_message = "Zombies are trampling on non-dead zombies"
         | 
| 228 | 
            +
                assert_that_representations_include_these_representations(expected_representations, human_results, zombies_results, failure_message)
         | 
| 229 | 
            +
              end
         | 
| 230 | 
            +
             | 
| 231 | 
            +
              def dont_test_zombies_do_not_collide
         | 
| 232 | 
            +
                human_results = [:pass] * 10
         | 
| 233 | 
            +
                zombies_results = [[:pass] * 10, [:pass] * 10]
         | 
| 234 | 
            +
                unexpected_regexp = /\A\.\.+Z\.+\@/ #Only one square with zombies, the second zombie should have appeared by now, and the human hasn't been eaten
         | 
| 235 | 
            +
                failure_message = "Zombies are sharing the same square"
         | 
| 236 | 
            +
                100.times do |i|
         | 
| 237 | 
            +
                  assert_that_representations_do_not_include_regexp_match(unexpected_regexp, human_results, zombies_results, failure_message + "(attempt #{i})")
         | 
| 238 | 
            +
                end
         | 
| 239 | 
            +
              end
         | 
| 240 | 
            +
             | 
| 241 | 
            +
              def test_multiple_successful_zombies_do_not_deadlock
         | 
| 242 | 
            +
                human_results = [:pass] * 2
         | 
| 243 | 
            +
                zombies_results = [[:pass] * 2] * 2
         | 
| 244 | 
            +
                failure_message = "Multiple successful zombies deadlock (pardon the pun)"
         | 
| 245 | 
            +
                assert_does_not_deadlock(human_results, zombies_results, failure_message)
         | 
| 246 | 
            +
              end
         | 
| 247 | 
            +
             | 
| 248 | 
            +
              #Confirming existing behaviour
         | 
| 249 | 
            +
              def test_zombie_does_not_deadlock_when_console_position_adjusted
         | 
| 250 | 
            +
                ConsoleInterface.width = 10
         | 
| 251 | 
            +
                human_results = [:pass] * 25
         | 
| 252 | 
            +
                zombies_results = [[:pass]*25]
         | 
| 253 | 
            +
                failure_message = "A zombie that isn't changing squares because of width limitations deadlocks (pardon the pun)"
         | 
| 254 | 
            +
                assert_does_not_deadlock(human_results, zombies_results, failure_message)
         | 
| 255 | 
            +
              end
         | 
| 256 | 
            +
             | 
| 257 | 
            +
              def teardown
         | 
| 258 | 
            +
                ConsoleInterface.width = 79
         | 
| 259 | 
            +
              end
         | 
| 260 | 
            +
             | 
| 261 | 
            +
            end
         | 
| 262 | 
            +
             | 
| 263 | 
            +
            class TestZombieHumanInteraction < Test::Unit::TestCase
         | 
| 264 | 
            +
              include TestHumanHelper
         | 
| 265 | 
            +
             | 
| 266 | 
            +
              def test_zombies_eat_human
         | 
| 267 | 
            +
                human_results = [:pass, :pass]
         | 
| 268 | 
            +
                zombies_results = [[:pass, :pass]]
         | 
| 269 | 
            +
                human_expected_to_die = true
         | 
| 270 | 
            +
                failure_message = "Human not eaten"
         | 
| 271 | 
            +
                assert_that_human_deadness_is human_expected_to_die, human_results, zombies_results, failure_message
         | 
| 272 | 
            +
              end
         | 
| 273 | 
            +
            end
         | 
| 274 | 
            +
             | 
| 275 | 
            +
            class TestResultsReporting < Test::Unit::TestCase
         | 
| 276 | 
            +
              include TestHumanHelper
         | 
| 277 | 
            +
             | 
| 278 | 
            +
              def test_killed_zombies_reported_as_success
         | 
| 279 | 
            +
                human_results = [:pass]
         | 
| 280 | 
            +
                zombies_results = [[:failure]]
         | 
| 281 | 
            +
                expected_counts = {true=>1}
         | 
| 282 | 
            +
                failure_message = "All zombies killed not regarded as all good"
         | 
| 283 | 
            +
                assert_that_counts_are expected_counts, human_results, zombies_results, failure_message
         | 
| 284 | 
            +
              end
         | 
| 285 | 
            +
             | 
| 286 | 
            +
              def test_unkilled_zombies_reported_as_failure
         | 
| 287 | 
            +
                human_results = [:pass]
         | 
| 288 | 
            +
                zombies_results = [[:pass]]
         | 
| 289 | 
            +
                expected_counts = {false => 1}
         | 
| 290 | 
            +
                failure_message = "Unkilled zombie not regarded as a problem"
         | 
| 291 | 
            +
                assert_that_counts_are expected_counts, human_results, zombies_results, failure_message
         | 
| 292 | 
            +
              end
         | 
| 293 | 
            +
             | 
| 294 | 
            +
              def test_timeouts_reported_as_success
         | 
| 295 | 
            +
                human_results = [:pass]
         | 
| 296 | 
            +
                zombies_results = [[:timeout]]
         | 
| 297 | 
            +
                expected_counts = {true => 1}
         | 
| 298 | 
            +
                failure_message = "Zombie causing timeout not regarded as all good"
         | 
| 299 | 
            +
                assert_that_counts_are expected_counts, human_results, zombies_results, failure_message
         | 
| 300 | 
            +
              end
         | 
| 301 | 
            +
             | 
| 302 | 
            +
            end
         | 
    
        data/zombie-chaser.gemspec
    CHANGED
    
    | @@ -1,88 +1,88 @@ | |
| 1 | 
            -
            # Generated by jeweler
         | 
| 2 | 
            -
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            -
            # Instead, edit Jeweler::Tasks in  | 
| 4 | 
            -
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            Gem::Specification.new do |s|
         | 
| 7 | 
            -
              s.name = %q{zombie-chaser}
         | 
| 8 | 
            -
              s.version = "0.0 | 
| 9 | 
            -
             | 
| 10 | 
            -
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            -
              s.authors = ["Andrew Grimm", "Ryan Davis", "Eric Hodel", "Kevin Clark"]
         | 
| 12 | 
            -
              s.date = %q{ | 
| 13 | 
            -
              s.default_executable = %q{zombie-chaser}
         | 
| 14 | 
            -
              s.description = %q{A zombie-themed graphic(al) user interface for mutation testing}
         | 
| 15 | 
            -
              s.email = %q{andrew.j.grimm@gmail.com}
         | 
| 16 | 
            -
              s.executables = ["zombie-chaser"]
         | 
| 17 | 
            -
              s.extra_rdoc_files = [
         | 
| 18 | 
            -
                "README.txt"
         | 
| 19 | 
            -
              ]
         | 
| 20 | 
            -
              s.files = [
         | 
| 21 | 
            -
                " | 
| 22 | 
            -
                 " | 
| 23 | 
            -
                 " | 
| 24 | 
            -
                 " | 
| 25 | 
            -
                 "lib/ | 
| 26 | 
            -
                 "lib/ | 
| 27 | 
            -
                 "lib/ | 
| 28 | 
            -
                 "lib/ | 
| 29 | 
            -
                 "lib/ | 
| 30 | 
            -
                 " | 
| 31 | 
            -
                 " | 
| 32 | 
            -
                 " | 
| 33 | 
            -
                 " | 
| 34 | 
            -
                 " | 
| 35 | 
            -
                 " | 
| 36 | 
            -
                 " | 
| 37 | 
            -
                 " | 
| 38 | 
            -
                 " | 
| 39 | 
            -
                 " | 
| 40 | 
            -
                 " | 
| 41 | 
            -
                 " | 
| 42 | 
            -
                 " | 
| 43 | 
            -
                 " | 
| 44 | 
            -
                 " | 
| 45 | 
            -
                 " | 
| 46 | 
            -
                 " | 
| 47 | 
            -
                 " | 
| 48 | 
            -
                 " | 
| 49 | 
            -
                 " | 
| 50 | 
            -
                 " | 
| 51 | 
            -
                 " | 
| 52 | 
            -
                 " | 
| 53 | 
            -
                 " | 
| 54 | 
            -
                 " | 
| 55 | 
            -
                 " | 
| 56 | 
            -
                 " | 
| 57 | 
            -
                 " | 
| 58 | 
            -
                 " | 
| 59 | 
            -
                 " | 
| 60 | 
            -
                 " | 
| 61 | 
            -
                 " | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
               | 
| 65 | 
            -
              s. | 
| 66 | 
            -
              s. | 
| 67 | 
            -
              s. | 
| 68 | 
            -
              s. | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
                 "test/ | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
                 | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 83 | 
            -
                 | 
| 84 | 
            -
             | 
| 85 | 
            -
             | 
| 86 | 
            -
              end
         | 
| 87 | 
            -
            end
         | 
| 88 | 
            -
             | 
| 1 | 
            +
            # Generated by jeweler
         | 
| 2 | 
            +
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 | 
            +
            # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
         | 
| 4 | 
            +
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            Gem::Specification.new do |s|
         | 
| 7 | 
            +
              s.name = %q{zombie-chaser}
         | 
| 8 | 
            +
              s.version = "0.1.0"
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 | 
            +
              s.authors = ["Andrew Grimm", "Ryan Davis", "Eric Hodel", "Kevin Clark"]
         | 
| 12 | 
            +
              s.date = %q{2010-04-11}
         | 
| 13 | 
            +
              s.default_executable = %q{zombie-chaser}
         | 
| 14 | 
            +
              s.description = %q{A zombie-themed graphic(al) user interface for mutation testing}
         | 
| 15 | 
            +
              s.email = %q{andrew.j.grimm@gmail.com}
         | 
| 16 | 
            +
              s.executables = ["zombie-chaser"]
         | 
| 17 | 
            +
              s.extra_rdoc_files = [
         | 
| 18 | 
            +
                "README.txt"
         | 
| 19 | 
            +
              ]
         | 
| 20 | 
            +
              s.files = [
         | 
| 21 | 
            +
                "History.txt",
         | 
| 22 | 
            +
                 "README.txt",
         | 
| 23 | 
            +
                 "Rakefile",
         | 
| 24 | 
            +
                 "bin/zombie-chaser",
         | 
| 25 | 
            +
                 "lib/zombie-chaser/chaser.rb",
         | 
| 26 | 
            +
                 "lib/zombie-chaser/human.rb",
         | 
| 27 | 
            +
                 "lib/zombie-chaser/icons/death.png",
         | 
| 28 | 
            +
                 "lib/zombie-chaser/icons/robot.png",
         | 
| 29 | 
            +
                 "lib/zombie-chaser/interface.rb",
         | 
| 30 | 
            +
                 "lib/zombie-chaser/sprites/robot-attacking.png",
         | 
| 31 | 
            +
                 "lib/zombie-chaser/sprites/robot-dead.png",
         | 
| 32 | 
            +
                 "lib/zombie-chaser/sprites/robot-dying.png",
         | 
| 33 | 
            +
                 "lib/zombie-chaser/sprites/robot-idle.png",
         | 
| 34 | 
            +
                 "lib/zombie-chaser/sprites/robot-moving.png",
         | 
| 35 | 
            +
                 "lib/zombie-chaser/sprites/robot-turning.png",
         | 
| 36 | 
            +
                 "lib/zombie-chaser/sprites/tank-attacking.png",
         | 
| 37 | 
            +
                 "lib/zombie-chaser/sprites/tank-dead.png",
         | 
| 38 | 
            +
                 "lib/zombie-chaser/sprites/tank-idle.png",
         | 
| 39 | 
            +
                 "lib/zombie-chaser/sprites/tank-moving.png",
         | 
| 40 | 
            +
                 "lib/zombie-chaser/sprites/tank-turning.png",
         | 
| 41 | 
            +
                 "lib/zombie-chaser/sprites/witch-attacking.png",
         | 
| 42 | 
            +
                 "lib/zombie-chaser/sprites/witch-dead.png",
         | 
| 43 | 
            +
                 "lib/zombie-chaser/sprites/witch-idle.png",
         | 
| 44 | 
            +
                 "lib/zombie-chaser/sprites/witch-moving.png",
         | 
| 45 | 
            +
                 "lib/zombie-chaser/sprites/witch-turning.png",
         | 
| 46 | 
            +
                 "lib/zombie-chaser/sprites/zombie-attacking.png",
         | 
| 47 | 
            +
                 "lib/zombie-chaser/sprites/zombie-dead.png",
         | 
| 48 | 
            +
                 "lib/zombie-chaser/sprites/zombie-dying.png",
         | 
| 49 | 
            +
                 "lib/zombie-chaser/sprites/zombie-idle.png",
         | 
| 50 | 
            +
                 "lib/zombie-chaser/sprites/zombie-moving.png",
         | 
| 51 | 
            +
                 "lib/zombie-chaser/sprites/zombie-turning.png",
         | 
| 52 | 
            +
                 "lib/zombie-chaser/test_unit_handler.rb",
         | 
| 53 | 
            +
                 "lib/zombie-chaser/tiles/grass.png",
         | 
| 54 | 
            +
                 "lib/zombie-chaser/tiles/shrubbery.png",
         | 
| 55 | 
            +
                 "lib/zombie-chaser/ui.rb",
         | 
| 56 | 
            +
                 "lib/zombie-chaser/world.rb",
         | 
| 57 | 
            +
                 "lib/zombie-chaser/zombie_test_chaser.rb",
         | 
| 58 | 
            +
                 "test/fixtures/chased.rb",
         | 
| 59 | 
            +
                 "test/integration.rb",
         | 
| 60 | 
            +
                 "test/test_chaser.rb",
         | 
| 61 | 
            +
                 "test/test_unit.rb",
         | 
| 62 | 
            +
                 "test/test_zombie.rb",
         | 
| 63 | 
            +
                 "zombie-chaser.gemspec"
         | 
| 64 | 
            +
              ]
         | 
| 65 | 
            +
              s.homepage = %q{http://andrewjgrimm.wordpress.com/2009/11/08/declare-war-on-everything-with-chaser/}
         | 
| 66 | 
            +
              s.rdoc_options = ["--charset=UTF-8"]
         | 
| 67 | 
            +
              s.require_paths = ["lib"]
         | 
| 68 | 
            +
              s.rubygems_version = %q{1.3.5}
         | 
| 69 | 
            +
              s.summary = %q{Lightweight mutation testing ... with ZOMBIES!!!}
         | 
| 70 | 
            +
              s.test_files = [
         | 
| 71 | 
            +
                "test/fixtures/chased.rb",
         | 
| 72 | 
            +
                 "test/integration.rb",
         | 
| 73 | 
            +
                 "test/test_chaser.rb",
         | 
| 74 | 
            +
                 "test/test_unit.rb",
         | 
| 75 | 
            +
                 "test/test_zombie.rb"
         | 
| 76 | 
            +
              ]
         | 
| 77 | 
            +
             | 
| 78 | 
            +
              if s.respond_to? :specification_version then
         | 
| 79 | 
            +
                current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
         | 
| 80 | 
            +
                s.specification_version = 3
         | 
| 81 | 
            +
             | 
| 82 | 
            +
                if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
         | 
| 83 | 
            +
                else
         | 
| 84 | 
            +
                end
         | 
| 85 | 
            +
              else
         | 
| 86 | 
            +
              end
         | 
| 87 | 
            +
            end
         | 
| 88 | 
            +
             |