heckle 1.1.1 → 1.2.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 +12 -0
- data/Manifest.txt +0 -2
- data/bin/heckle +21 -2
- data/lib/heckle.rb +441 -2
- data/lib/test_unit_heckler.rb +30 -20
- data/sample/lib/heckled.rb +13 -0
- data/sample/test/test_heckled.rb +8 -0
- data/test/fixtures/heckled.rb +21 -17
- data/test/test_heckle.rb +221 -466
- metadata +7 -9
- data/lib/heckle/base.rb +0 -352
- data/lib/heckle/reporter.rb +0 -43
    
        data/test/test_heckle.rb
    CHANGED
    
    | @@ -6,53 +6,86 @@ require 'test/unit' if $0 == __FILE__ | |
| 6 6 | 
             
            require 'test_unit_heckler'
         | 
| 7 7 | 
             
            require 'heckled'
         | 
| 8 8 |  | 
| 9 | 
            -
             | 
| 10 | 
            -
               | 
| 11 | 
            -
                 | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
                 | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
                 | 
| 24 | 
            -
             | 
| 25 | 
            -
                alias_method :old_rand_symbol, :rand_symbol
         | 
| 26 | 
            -
                def rand_symbol
         | 
| 27 | 
            -
                  :"l33t h4x0r"
         | 
| 28 | 
            -
                end
         | 
| 9 | 
            +
            class TestHeckler < Heckle
         | 
| 10 | 
            +
              def rand(*args)
         | 
| 11 | 
            +
                5
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              def rand_string
         | 
| 15 | 
            +
                "l33t h4x0r"
         | 
| 16 | 
            +
              end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
              def rand_number(*args)
         | 
| 19 | 
            +
                5
         | 
| 20 | 
            +
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              def rand_symbol
         | 
| 23 | 
            +
                :"l33t h4x0r"
         | 
| 29 24 | 
             
              end
         | 
| 30 25 | 
             
            end
         | 
| 31 26 |  | 
| 32 | 
            -
            class  | 
| 27 | 
            +
            class HeckleTestCase < Test::Unit::TestCase
         | 
| 28 | 
            +
              undef_method :default_test
         | 
| 33 29 | 
             
              def setup
         | 
| 34 | 
            -
                 | 
| 30 | 
            +
                data = self.class.name["TestHeckle".size..-1].gsub(/([A-Z])/, '_\1').downcase
         | 
| 31 | 
            +
                data = "_many_things" if data.empty?
         | 
| 32 | 
            +
                @heckler = TestHeckler.new("Heckled", "uses#{data}")
         | 
| 33 | 
            +
              end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              def teardown
         | 
| 36 | 
            +
                @heckler.reset
         | 
| 35 37 | 
             
              end
         | 
| 38 | 
            +
            end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            class LiteralHeckleTestCase < HeckleTestCase
         | 
| 41 | 
            +
              def toggle(value, toggle)
         | 
| 42 | 
            +
                toggle ? self.class::TOGGLE_VALUE : value
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
             | 
| 45 | 
            +
              def test_default_structure
         | 
| 46 | 
            +
                return if self.class == LiteralHeckleTestCase
         | 
| 47 | 
            +
                assert_equal util_expected, @heckler.current_tree
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              def test_should_iterate_mutations
         | 
| 51 | 
            +
                return if self.class == LiteralHeckleTestCase
         | 
| 52 | 
            +
                @heckler.process(@heckler.current_tree)
         | 
| 53 | 
            +
                assert_equal util_expected(1), @heckler.current_tree
         | 
| 36 54 |  | 
| 55 | 
            +
                @heckler.reset_tree
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                @heckler.process(@heckler.current_tree)
         | 
| 58 | 
            +
                assert_equal util_expected(2), @heckler.current_tree
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                @heckler.reset_tree
         | 
| 61 | 
            +
             | 
| 62 | 
            +
                @heckler.process(@heckler.current_tree)
         | 
| 63 | 
            +
                assert_equal util_expected(3), @heckler.current_tree
         | 
| 64 | 
            +
              end
         | 
| 65 | 
            +
            end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
            class TestHeckle < HeckleTestCase
         | 
| 37 68 | 
             
              def test_should_set_original_tree
         | 
| 38 | 
            -
                expected = [:defn,
         | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            -
             | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 52 | 
            -
             | 
| 53 | 
            -
             | 
| 54 | 
            -
             | 
| 55 | 
            -
             | 
| 69 | 
            +
                expected = [:defn, :uses_many_things,
         | 
| 70 | 
            +
                            [:fbody,
         | 
| 71 | 
            +
                             [:scope,
         | 
| 72 | 
            +
                              [:block,
         | 
| 73 | 
            +
                               [:args],
         | 
| 74 | 
            +
                               [:lasgn, :i, [:lit, 1]],
         | 
| 75 | 
            +
                               [:while,
         | 
| 76 | 
            +
                                [:call, [:lvar, :i], :<, [:array, [:lit, 10]]],
         | 
| 77 | 
            +
                                [:block,
         | 
| 78 | 
            +
                                 [:lasgn, :i, [:call, [:lvar, :i], :+, [:array, [:lit, 1]]]],
         | 
| 79 | 
            +
                                 [:until, [:vcall, :some_func],
         | 
| 80 | 
            +
                                  [:vcall, :some_other_func], true],
         | 
| 81 | 
            +
                                 [:if,
         | 
| 82 | 
            +
                                  [:call, [:str, "hi there"], :==,
         | 
| 83 | 
            +
                                   [:array, [:str, "changeling"]]],
         | 
| 84 | 
            +
                                  [:return, [:true]],
         | 
| 85 | 
            +
                                  nil],
         | 
| 86 | 
            +
                                 [:return, [:false]]],
         | 
| 87 | 
            +
                                true],
         | 
| 88 | 
            +
                               [:lvar, :i]]]]]
         | 
| 56 89 |  | 
| 57 90 | 
             
                assert_equal expected, @heckler.original_tree
         | 
| 58 91 | 
             
              end
         | 
| @@ -60,26 +93,27 @@ class TestHeckle < Test::Unit::TestCase | |
| 60 93 | 
             
              def test_should_grab_mutatees_from_method
         | 
| 61 94 | 
             
                # expected is from tree of uses_while
         | 
| 62 95 | 
             
                expected = {
         | 
| 63 | 
            -
             | 
| 64 | 
            -
             | 
| 65 | 
            -
             | 
| 66 | 
            -
             | 
| 67 | 
            -
             | 
| 68 | 
            -
             | 
| 69 | 
            -
             | 
| 70 | 
            -
             | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
             | 
| 74 | 
            -
             | 
| 75 | 
            -
             | 
| 76 | 
            -
             | 
| 77 | 
            -
             | 
| 78 | 
            -
             | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
             | 
| 82 | 
            -
             | 
| 96 | 
            +
                  :lit => [[:lit, 1], [:lit, 10], [:lit, 1]],
         | 
| 97 | 
            +
                  :if => [[:if,
         | 
| 98 | 
            +
                           [:call, [:str, "hi there"], :==, [:array, [:str, "changeling"]]],
         | 
| 99 | 
            +
                           [:return, [:true]],
         | 
| 100 | 
            +
                           nil]],
         | 
| 101 | 
            +
                  :str => [[:str, "hi there"], [:str, "changeling"]],
         | 
| 102 | 
            +
                  :true => [[:true]],
         | 
| 103 | 
            +
                  :false => [[:false]],
         | 
| 104 | 
            +
                  :while => [[:while,
         | 
| 105 | 
            +
                              [:call, [:lvar, :i], :<, [:array, [:lit, 10]]],
         | 
| 106 | 
            +
                              [:block,
         | 
| 107 | 
            +
                               [:lasgn, :i, [:call, [:lvar, :i], :+, [:array, [:lit, 1]]]],
         | 
| 108 | 
            +
                               [:until, [:vcall, :some_func],
         | 
| 109 | 
            +
                                [:vcall, :some_other_func], true],
         | 
| 110 | 
            +
                               [:if,
         | 
| 111 | 
            +
                                [:call, [:str, "hi there"], :==,
         | 
| 112 | 
            +
                                 [:array, [:str, "changeling"]]],
         | 
| 113 | 
            +
                                [:return, [:true]],
         | 
| 114 | 
            +
                                nil],
         | 
| 115 | 
            +
                               [:return, [:false]]],
         | 
| 116 | 
            +
                              true]],
         | 
| 83 117 | 
             
                  :until => [[:until, [:vcall, :some_func], [:vcall, :some_other_func], true]]
         | 
| 84 118 | 
             
                }
         | 
| 85 119 |  | 
| @@ -144,523 +178,244 @@ class TestHeckle < Test::Unit::TestCase | |
| 144 178 | 
             
                @heckler.reset_mutatees
         | 
| 145 179 | 
             
                assert_equal original_mutatees, @heckler.mutatees
         | 
| 146 180 | 
             
              end
         | 
| 147 | 
            -
             | 
| 148 | 
            -
              def teardown
         | 
| 149 | 
            -
                @heckler.reset
         | 
| 150 | 
            -
              end
         | 
| 151 181 | 
             
            end
         | 
| 152 182 |  | 
| 153 | 
            -
            class  | 
| 154 | 
            -
              def  | 
| 155 | 
            -
                 | 
| 183 | 
            +
            class TestHeckleNumericLiterals < HeckleTestCase
         | 
| 184 | 
            +
              def toggle(value, toggle)
         | 
| 185 | 
            +
                value + (toggle ? 5 : 0)
         | 
| 156 186 | 
             
              end
         | 
| 157 187 |  | 
| 158 | 
            -
              def  | 
| 159 | 
            -
                 | 
| 160 | 
            -
                expected = [:defn,
         | 
| 161 | 
            -
                 :uses_numeric_literals,
         | 
| 188 | 
            +
              def util_expected(n)
         | 
| 189 | 
            +
                [:defn, :uses_numeric_literals,
         | 
| 162 190 | 
             
                 [:scope,
         | 
| 163 191 | 
             
                  [:block,
         | 
| 164 192 | 
             
                   [:args],
         | 
| 165 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 166 | 
            -
                   [:lasgn, :i, [:call, [:lvar, :i], :+, | 
| 167 | 
            -
             | 
| 168 | 
            -
             | 
| 169 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 170 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 171 | 
            -
             | 
| 172 | 
            -
                @heckler.reset_tree
         | 
| 173 | 
            -
             | 
| 174 | 
            -
                expected = [:defn,
         | 
| 175 | 
            -
                 :uses_numeric_literals,
         | 
| 176 | 
            -
                 [:scope,
         | 
| 177 | 
            -
                  [:block,
         | 
| 178 | 
            -
                   [:args],
         | 
| 179 | 
            -
                   [:lasgn, :i, [:lit, 1]],
         | 
| 180 | 
            -
                   [:lasgn, :i, [:call, [:lvar, :i], :+, [:array, [:lit, 2147483653]]]],
         | 
| 181 | 
            -
                   [:lasgn, :i, [:call, [:lvar, :i], :-, [:array, [:lit, 3.5]]]]]]]
         | 
| 182 | 
            -
             | 
| 183 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 184 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 185 | 
            -
             | 
| 186 | 
            -
                @heckler.reset_tree
         | 
| 187 | 
            -
             | 
| 188 | 
            -
                expected = [:defn,
         | 
| 189 | 
            -
                 :uses_numeric_literals,
         | 
| 190 | 
            -
                 [:scope,
         | 
| 191 | 
            -
                  [:block,
         | 
| 192 | 
            -
                   [:args],
         | 
| 193 | 
            -
                   [:lasgn, :i, [:lit, 1]],
         | 
| 194 | 
            -
                   [:lasgn, :i, [:call, [:lvar, :i], :+, [:array, [:lit, 2147483648]]]],
         | 
| 195 | 
            -
                   [:lasgn, :i, [:call, [:lvar, :i], :-, [:array, [:lit, 8.5]]]]]]]
         | 
| 196 | 
            -
             | 
| 197 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 198 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 199 | 
            -
              end
         | 
| 200 | 
            -
             | 
| 201 | 
            -
              def teardown
         | 
| 202 | 
            -
                @heckler.reset
         | 
| 193 | 
            +
                   [:lasgn, :i, [:lit, toggle(1, 1 == n)]],
         | 
| 194 | 
            +
                   [:lasgn, :i, [:call, [:lvar, :i], :+,
         | 
| 195 | 
            +
                                 [:array, [:lit, toggle(2147483648, 2 == n)]]]],
         | 
| 196 | 
            +
                   [:lasgn, :i, [:call, [:lvar, :i], :-, [:array, [:lit, toggle(3.5, 3 == n)]]]]]]]
         | 
| 203 197 | 
             
              end
         | 
| 204 198 | 
             
            end
         | 
| 205 199 |  | 
| 206 | 
            -
            class TestHeckleSymbols <  | 
| 207 | 
            -
               | 
| 208 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_symbols")
         | 
| 209 | 
            -
              end
         | 
| 200 | 
            +
            class TestHeckleSymbols < LiteralHeckleTestCase
         | 
| 201 | 
            +
              TOGGLE_VALUE = :"l33t h4x0r"
         | 
| 210 202 |  | 
| 211 | 
            -
              def  | 
| 212 | 
            -
                 | 
| 213 | 
            -
                 :uses_symbols,
         | 
| 203 | 
            +
              def util_expected(n = nil)
         | 
| 204 | 
            +
                [:defn, :uses_symbols,
         | 
| 214 205 | 
             
                 [:scope,
         | 
| 215 206 | 
             
                  [:block,
         | 
| 216 207 | 
             
                   [:args],
         | 
| 217 | 
            -
                   [:lasgn, :i, [:lit, :blah]],
         | 
| 218 | 
            -
                   [:lasgn, :i, [:lit, :blah]],
         | 
| 219 | 
            -
                   [:lasgn, :i, [:lit, :and_blah]]]]]
         | 
| 220 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 208 | 
            +
                   [:lasgn, :i, [:lit, toggle(:blah, n == 1)]],
         | 
| 209 | 
            +
                   [:lasgn, :i, [:lit, toggle(:blah, n == 2)]],
         | 
| 210 | 
            +
                   [:lasgn, :i, [:lit, toggle(:and_blah, n == 3)]]]]]
         | 
| 221 211 | 
             
              end
         | 
| 212 | 
            +
            end
         | 
| 222 213 |  | 
| 214 | 
            +
            class TestHeckleRegexes < LiteralHeckleTestCase
         | 
| 215 | 
            +
              TOGGLE_VALUE = /l33t\ h4x0r/
         | 
| 223 216 |  | 
| 224 | 
            -
              def  | 
| 225 | 
            -
                 | 
| 226 | 
            -
                 :uses_symbols,
         | 
| 227 | 
            -
                 [:scope,
         | 
| 228 | 
            -
                  [:block,
         | 
| 229 | 
            -
                   [:args],
         | 
| 230 | 
            -
                   [:lasgn, :i, [:lit, :"l33t h4x0r"]],
         | 
| 231 | 
            -
                   [:lasgn, :i, [:lit, :blah]],
         | 
| 232 | 
            -
                   [:lasgn, :i, [:lit, :and_blah]]]]]
         | 
| 233 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 234 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 235 | 
            -
             | 
| 236 | 
            -
                @heckler.reset_tree
         | 
| 237 | 
            -
             | 
| 238 | 
            -
                expected = [:defn,
         | 
| 239 | 
            -
                 :uses_symbols,
         | 
| 240 | 
            -
                 [:scope,
         | 
| 241 | 
            -
                  [:block,
         | 
| 242 | 
            -
                   [:args],
         | 
| 243 | 
            -
                   [:lasgn, :i, [:lit, :blah]],
         | 
| 244 | 
            -
                   [:lasgn, :i, [:lit, :"l33t h4x0r"]],
         | 
| 245 | 
            -
                   [:lasgn, :i, [:lit, :and_blah]]]]]
         | 
| 246 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 247 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 248 | 
            -
             | 
| 249 | 
            -
                @heckler.reset_tree
         | 
| 250 | 
            -
             | 
| 251 | 
            -
                expected = [:defn,
         | 
| 252 | 
            -
                 :uses_symbols,
         | 
| 217 | 
            +
              def util_expected(n = nil)
         | 
| 218 | 
            +
                [:defn, :uses_regexes,
         | 
| 253 219 | 
             
                 [:scope,
         | 
| 254 220 | 
             
                  [:block,
         | 
| 255 221 | 
             
                   [:args],
         | 
| 256 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 257 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 258 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 259 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 260 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 222 | 
            +
                   [:lasgn, :i, [:lit, toggle(/a.*/, n == 1)]],
         | 
| 223 | 
            +
                   [:lasgn, :i, [:lit, toggle(/c{2,4}+/, n == 2)]],
         | 
| 224 | 
            +
                   [:lasgn, :i, [:lit, toggle(/123/, n == 3)]]]]]
         | 
| 261 225 | 
             
              end
         | 
| 262 226 | 
             
            end
         | 
| 263 227 |  | 
| 264 | 
            -
            class  | 
| 265 | 
            -
               | 
| 266 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_regexes")
         | 
| 267 | 
            -
              end
         | 
| 228 | 
            +
            class TestHeckleRanges < LiteralHeckleTestCase
         | 
| 229 | 
            +
              TOGGLE_VALUE = 5..10
         | 
| 268 230 |  | 
| 269 | 
            -
              def  | 
| 270 | 
            -
                 | 
| 271 | 
            -
                 :uses_regexes,
         | 
| 231 | 
            +
              def util_expected(n = nil)
         | 
| 232 | 
            +
                [:defn, :uses_ranges,
         | 
| 272 233 | 
             
                 [:scope,
         | 
| 273 234 | 
             
                  [:block,
         | 
| 274 235 | 
             
                   [:args],
         | 
| 275 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 276 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 277 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 278 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 236 | 
            +
                   [:lasgn, :i, [:lit, toggle(6..100, n == 1)]],
         | 
| 237 | 
            +
                   [:lasgn, :i, [:lit, toggle(-1..9, n == 2)]],
         | 
| 238 | 
            +
                   [:lasgn, :i, [:lit, toggle(1..4, n == 3)]]]]]
         | 
| 279 239 | 
             
              end
         | 
| 240 | 
            +
            end
         | 
| 280 241 |  | 
| 281 242 |  | 
| 282 | 
            -
             | 
| 283 | 
            -
             | 
| 284 | 
            -
                 :uses_regexes,
         | 
| 285 | 
            -
                 [:scope,
         | 
| 286 | 
            -
                  [:block,
         | 
| 287 | 
            -
                   [:args],
         | 
| 288 | 
            -
                   [:lasgn, :i, [:lit, /l33t\ h4x0r/]],
         | 
| 289 | 
            -
                   [:lasgn, :i, [:lit, /c{2,4}+/]],
         | 
| 290 | 
            -
                   [:lasgn, :i, [:lit, /123/]]]]]
         | 
| 291 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 292 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 293 | 
            -
             | 
| 294 | 
            -
                @heckler.reset_tree
         | 
| 243 | 
            +
            class TestHeckleSameLiteral < LiteralHeckleTestCase
         | 
| 244 | 
            +
              TOGGLE_VALUE = 6
         | 
| 295 245 |  | 
| 296 | 
            -
             | 
| 297 | 
            -
             | 
| 246 | 
            +
              def util_expected(n = nil)
         | 
| 247 | 
            +
                [:defn, :uses_same_literal,
         | 
| 298 248 | 
             
                 [:scope,
         | 
| 299 249 | 
             
                  [:block,
         | 
| 300 250 | 
             
                   [:args],
         | 
| 301 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 302 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 303 | 
            -
                   [:lasgn, :i, [:lit,  | 
| 304 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 305 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 306 | 
            -
             | 
| 307 | 
            -
                @heckler.reset_tree
         | 
| 308 | 
            -
             | 
| 309 | 
            -
                expected = [:defn,
         | 
| 310 | 
            -
                 :uses_regexes,
         | 
| 311 | 
            -
                 [:scope,
         | 
| 312 | 
            -
                  [:block,
         | 
| 313 | 
            -
                   [:args],
         | 
| 314 | 
            -
                   [:lasgn, :i, [:lit, /a.*/]],
         | 
| 315 | 
            -
                   [:lasgn, :i, [:lit, /c{2,4}+/]],
         | 
| 316 | 
            -
                   [:lasgn, :i, [:lit, /l33t\ h4x0r/]]]]]
         | 
| 317 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 318 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 251 | 
            +
                   [:lasgn, :i, [:lit, toggle(1, n == 1)]],
         | 
| 252 | 
            +
                   [:lasgn, :i, [:lit, toggle(1, n == 2)]],
         | 
| 253 | 
            +
                   [:lasgn, :i, [:lit, toggle(1, n == 3)]]]]]
         | 
| 319 254 | 
             
              end
         | 
| 320 255 | 
             
            end
         | 
| 321 256 |  | 
| 322 | 
            -
            class  | 
| 323 | 
            -
               | 
| 324 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_ranges")
         | 
| 325 | 
            -
              end
         | 
| 257 | 
            +
            class TestHeckleStrings < LiteralHeckleTestCase
         | 
| 258 | 
            +
              TOGGLE_VALUE = "l33t h4x0r"
         | 
| 326 259 |  | 
| 327 | 
            -
              def  | 
| 328 | 
            -
                 | 
| 329 | 
            -
                 :uses_ranges,
         | 
| 260 | 
            +
              def util_expected(n = nil)
         | 
| 261 | 
            +
                [:defn, :uses_strings,
         | 
| 330 262 | 
             
                 [:scope,
         | 
| 331 263 | 
             
                  [:block,
         | 
| 332 264 | 
             
                   [:args],
         | 
| 333 | 
            -
                   [: | 
| 334 | 
            -
                   [: | 
| 335 | 
            -
                   [: | 
| 336 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 337 | 
            -
              end
         | 
| 338 | 
            -
             | 
| 339 | 
            -
              def test_should_randomize_symbol
         | 
| 340 | 
            -
                expected = [:defn,
         | 
| 341 | 
            -
                 :uses_ranges,
         | 
| 342 | 
            -
                 [:scope,
         | 
| 343 | 
            -
                  [:block,
         | 
| 344 | 
            -
                   [:args],
         | 
| 345 | 
            -
                   [:lasgn, :i, [:lit, 5..10]],
         | 
| 346 | 
            -
                   [:lasgn, :i, [:lit, -1..9]],
         | 
| 347 | 
            -
                   [:lasgn, :i, [:lit, 1..4]]]]]
         | 
| 348 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 349 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 350 | 
            -
             | 
| 351 | 
            -
                @heckler.reset_tree
         | 
| 352 | 
            -
             | 
| 353 | 
            -
                expected = [:defn,
         | 
| 354 | 
            -
                 :uses_ranges,
         | 
| 355 | 
            -
                 [:scope,
         | 
| 356 | 
            -
                  [:block,
         | 
| 357 | 
            -
                   [:args],
         | 
| 358 | 
            -
                   [:lasgn, :i, [:lit, 6..100]],
         | 
| 359 | 
            -
                   [:lasgn, :i, [:lit, 5..10]],
         | 
| 360 | 
            -
                   [:lasgn, :i, [:lit, 1..4]]]]]
         | 
| 361 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 362 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 363 | 
            -
             | 
| 364 | 
            -
                @heckler.reset_tree
         | 
| 365 | 
            -
             | 
| 366 | 
            -
                expected = [:defn,
         | 
| 367 | 
            -
                 :uses_ranges,
         | 
| 368 | 
            -
                 [:scope,
         | 
| 369 | 
            -
                  [:block,
         | 
| 370 | 
            -
                   [:args],
         | 
| 371 | 
            -
                   [:lasgn, :i, [:lit, 6..100]],
         | 
| 372 | 
            -
                   [:lasgn, :i, [:lit, -1..9]],
         | 
| 373 | 
            -
                   [:lasgn, :i, [:lit, 5..10]]]]]
         | 
| 374 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 375 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 265 | 
            +
                   [:call, [:ivar, :@names], :<<, [:array, [:str, toggle("Hello, Robert", n == 1)]]],
         | 
| 266 | 
            +
                   [:call, [:ivar, :@names], :<<, [:array, [:str, toggle("Hello, Jeff", n == 2)]]],
         | 
| 267 | 
            +
                   [:call, [:ivar, :@names], :<<, [:array, [:str, toggle("Hi, Frank", n == 3)]]]]]]
         | 
| 376 268 | 
             
              end
         | 
| 377 269 | 
             
            end
         | 
| 378 270 |  | 
| 379 | 
            -
             | 
| 380 | 
            -
             | 
| 381 | 
            -
             | 
| 382 | 
            -
             | 
| 383 | 
            -
             | 
| 384 | 
            -
             | 
| 385 | 
            -
             | 
| 386 | 
            -
             | 
| 387 | 
            -
             | 
| 388 | 
            -
             | 
| 389 | 
            -
              def test_original_tree
         | 
| 390 | 
            -
                expected = [:defn,
         | 
| 391 | 
            -
                 :uses_the_same_literal,
         | 
| 392 | 
            -
                 [:fbody, [:scope,
         | 
| 393 | 
            -
                  [:block,
         | 
| 394 | 
            -
                   [:args],
         | 
| 395 | 
            -
                   [:lasgn, :i, [:lit, 1]],
         | 
| 396 | 
            -
                   [:lasgn, :i, [:lit, 1]],
         | 
| 397 | 
            -
                   [:lasgn, :i, [:lit, 1]]]]]]
         | 
| 271 | 
            +
            class TestHeckleIf < HeckleTestCase
         | 
| 272 | 
            +
              def test_default_structure
         | 
| 273 | 
            +
                expected = [:defn, :uses_if,
         | 
| 274 | 
            +
                            [:scope,
         | 
| 275 | 
            +
                             [:block,
         | 
| 276 | 
            +
                              [:args],
         | 
| 277 | 
            +
                              [:if,
         | 
| 278 | 
            +
                               [:vcall, :some_func],
         | 
| 279 | 
            +
                               [:if, [:vcall, :some_other_func], [:return], nil],
         | 
| 280 | 
            +
                               nil]]]]
         | 
| 398 281 |  | 
| 399 282 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 400 283 | 
             
              end
         | 
| 401 284 |  | 
| 402 | 
            -
              def  | 
| 403 | 
            -
                 | 
| 404 | 
            -
             | 
| 405 | 
            -
             | 
| 406 | 
            -
             | 
| 407 | 
            -
             | 
| 408 | 
            -
             | 
| 409 | 
            -
             | 
| 410 | 
            -
             | 
| 411 | 
            -
                   [:lasgn, :i, [:lit, 1]]]]]
         | 
| 412 | 
            -
             | 
| 413 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 414 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 415 | 
            -
             | 
| 416 | 
            -
                @heckler.reset_tree
         | 
| 417 | 
            -
             | 
| 418 | 
            -
                expected = [:defn,
         | 
| 419 | 
            -
                 :uses_the_same_literal,
         | 
| 420 | 
            -
                 [:scope,
         | 
| 421 | 
            -
                  [:block,
         | 
| 422 | 
            -
                   [:args],
         | 
| 423 | 
            -
                   [:lasgn, :i, [:lit, 1]],
         | 
| 424 | 
            -
                   [:lasgn, :i, [:lit, 6]],
         | 
| 425 | 
            -
                   [:lasgn, :i, [:lit, 1]]]]]
         | 
| 285 | 
            +
              def test_should_flip_if_to_unless
         | 
| 286 | 
            +
                expected = [:defn, :uses_if,
         | 
| 287 | 
            +
                            [:scope,
         | 
| 288 | 
            +
                             [:block,
         | 
| 289 | 
            +
                              [:args],
         | 
| 290 | 
            +
                              [:if,
         | 
| 291 | 
            +
                               [:vcall, :some_func],
         | 
| 292 | 
            +
                               [:if, [:vcall, :some_other_func], nil, [:return]],
         | 
| 293 | 
            +
                               nil]]]]
         | 
| 426 294 |  | 
| 427 295 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 428 296 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 429 297 |  | 
| 430 298 | 
             
                @heckler.reset_tree
         | 
| 431 299 |  | 
| 432 | 
            -
                expected = [:defn,
         | 
| 433 | 
            -
             | 
| 434 | 
            -
             | 
| 435 | 
            -
             | 
| 436 | 
            -
             | 
| 437 | 
            -
             | 
| 438 | 
            -
             | 
| 439 | 
            -
             | 
| 300 | 
            +
                expected = [:defn, :uses_if,
         | 
| 301 | 
            +
                            [:scope,
         | 
| 302 | 
            +
                             [:block,
         | 
| 303 | 
            +
                              [:args],
         | 
| 304 | 
            +
                              [:if,
         | 
| 305 | 
            +
                               [:vcall, :some_func],
         | 
| 306 | 
            +
                               nil,
         | 
| 307 | 
            +
                               [:if, [:vcall, :some_other_func], [:return], nil]]]]]
         | 
| 440 308 |  | 
| 441 309 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 442 310 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 443 311 | 
             
              end
         | 
| 444 312 | 
             
            end
         | 
| 445 313 |  | 
| 446 | 
            -
            class  | 
| 447 | 
            -
              def  | 
| 448 | 
            -
                 | 
| 449 | 
            -
              end
         | 
| 450 | 
            -
             | 
| 451 | 
            -
              def teardown
         | 
| 452 | 
            -
                @heckler.reset
         | 
| 453 | 
            -
              end
         | 
| 454 | 
            -
             | 
| 455 | 
            -
              def test_default_structure
         | 
| 456 | 
            -
                expected = [:defn,
         | 
| 457 | 
            -
                 :uses_strings,
         | 
| 458 | 
            -
                 [:scope,
         | 
| 459 | 
            -
                  [:block,
         | 
| 460 | 
            -
                   [:args],
         | 
| 461 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hello, Robert"]]],
         | 
| 462 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hello, Jeff"]]],
         | 
| 463 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hi, Frank"]]]]]]
         | 
| 464 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 314 | 
            +
            class TestHeckleBoolean < HeckleTestCase
         | 
| 315 | 
            +
              def toggle(value, toggle)
         | 
| 316 | 
            +
                (toggle ? ! value : value).to_s.intern
         | 
| 465 317 | 
             
              end
         | 
| 466 318 |  | 
| 467 | 
            -
              def  | 
| 468 | 
            -
                 | 
| 469 | 
            -
                 :uses_strings,
         | 
| 470 | 
            -
                 [:scope,
         | 
| 471 | 
            -
                  [:block,
         | 
| 472 | 
            -
                   [:args],
         | 
| 473 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "l33t h4x0r"]]],
         | 
| 474 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hello, Jeff"]]],
         | 
| 475 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hi, Frank"]]]]]]
         | 
| 476 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 477 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 478 | 
            -
             | 
| 479 | 
            -
                @heckler.reset_tree
         | 
| 480 | 
            -
             | 
| 481 | 
            -
                expected = [:defn,
         | 
| 482 | 
            -
                 :uses_strings,
         | 
| 319 | 
            +
              def util_expected(n = nil)
         | 
| 320 | 
            +
                [:defn, :uses_boolean,
         | 
| 483 321 | 
             
                 [:scope,
         | 
| 484 322 | 
             
                  [:block,
         | 
| 485 323 | 
             
                   [:args],
         | 
| 486 | 
            -
                   [: | 
| 487 | 
            -
                   [: | 
| 488 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hi, Frank"]]]]]]
         | 
| 489 | 
            -
             | 
| 490 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 491 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 492 | 
            -
             | 
| 493 | 
            -
                @heckler.reset_tree
         | 
| 494 | 
            -
             | 
| 495 | 
            -
                expected = [:defn,
         | 
| 496 | 
            -
                 :uses_strings,
         | 
| 497 | 
            -
                 [:scope,
         | 
| 498 | 
            -
                  [:block,
         | 
| 499 | 
            -
                   [:args],
         | 
| 500 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hello, Robert"]]],
         | 
| 501 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "Hello, Jeff"]]],
         | 
| 502 | 
            -
                   [:call, [:ivar, :@names], :<<, [:array, [:str, "l33t h4x0r"]]]]]]
         | 
| 503 | 
            -
             | 
| 504 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 505 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 506 | 
            -
              end
         | 
| 507 | 
            -
            end
         | 
| 508 | 
            -
             | 
| 509 | 
            -
            class TestHeckleIfs < Test::Unit::TestCase
         | 
| 510 | 
            -
              def setup
         | 
| 511 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_if")
         | 
| 512 | 
            -
              end
         | 
| 513 | 
            -
             | 
| 514 | 
            -
              def teardown
         | 
| 515 | 
            -
                @heckler.reset
         | 
| 324 | 
            +
                   [:lasgn, :a, [toggle(true, n == 1)]],
         | 
| 325 | 
            +
                   [:lasgn, :b, [toggle(false, n == 2)]]]]]
         | 
| 516 326 | 
             
              end
         | 
| 517 327 |  | 
| 518 328 | 
             
              def test_default_structure
         | 
| 519 | 
            -
                 | 
| 520 | 
            -
                 :uses_if,
         | 
| 521 | 
            -
                 [:scope,
         | 
| 522 | 
            -
                  [:block,
         | 
| 523 | 
            -
                   [:args],
         | 
| 524 | 
            -
                   [:if,
         | 
| 525 | 
            -
                    [:vcall, :some_func],
         | 
| 526 | 
            -
                    [:if, [:vcall, :some_other_func], [:return], nil],
         | 
| 527 | 
            -
                    nil]]]]
         | 
| 528 | 
            -
             | 
| 529 | 
            -
             | 
| 530 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 329 | 
            +
                assert_equal util_expected, @heckler.current_tree
         | 
| 531 330 | 
             
              end
         | 
| 532 331 |  | 
| 533 | 
            -
              def  | 
| 534 | 
            -
                expected = [:defn,
         | 
| 535 | 
            -
                 :uses_if,
         | 
| 536 | 
            -
                 [:scope,
         | 
| 537 | 
            -
                  [:block,
         | 
| 538 | 
            -
                   [:args],
         | 
| 539 | 
            -
                   [:if,
         | 
| 540 | 
            -
                    [:vcall, :some_func],
         | 
| 541 | 
            -
                    [:if, [:vcall, :some_other_func], nil, [:return]],
         | 
| 542 | 
            -
                    nil]]]]
         | 
| 543 | 
            -
             | 
| 332 | 
            +
              def test_should_flip_true_to_false_and_false_to_true
         | 
| 544 333 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 545 | 
            -
                assert_equal  | 
| 334 | 
            +
                assert_equal util_expected(1), @heckler.current_tree
         | 
| 546 335 |  | 
| 547 336 | 
             
                @heckler.reset_tree
         | 
| 548 337 |  | 
| 549 | 
            -
                expected = [:defn,
         | 
| 550 | 
            -
                 :uses_if,
         | 
| 551 | 
            -
                 [:scope,
         | 
| 552 | 
            -
                  [:block,
         | 
| 553 | 
            -
                   [:args],
         | 
| 554 | 
            -
                   [:if,
         | 
| 555 | 
            -
                    [:vcall, :some_func],
         | 
| 556 | 
            -
                    nil,
         | 
| 557 | 
            -
                    [:if, [:vcall, :some_other_func], [:return], nil]]]]]
         | 
| 558 | 
            -
             | 
| 559 338 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 560 | 
            -
                assert_equal  | 
| 339 | 
            +
                assert_equal util_expected(2), @heckler.current_tree
         | 
| 561 340 | 
             
              end
         | 
| 562 341 | 
             
            end
         | 
| 563 342 |  | 
| 564 | 
            -
            class  | 
| 565 | 
            -
              def setup
         | 
| 566 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_boolean")
         | 
| 567 | 
            -
              end
         | 
| 568 | 
            -
             | 
| 569 | 
            -
              def teardown
         | 
| 570 | 
            -
                @heckler.reset
         | 
| 571 | 
            -
              end
         | 
| 572 | 
            -
             | 
| 343 | 
            +
            class TestHeckleWhile < HeckleTestCase
         | 
| 573 344 | 
             
              def test_default_structure
         | 
| 574 | 
            -
                expected = [:defn, : | 
| 345 | 
            +
                expected = [:defn, :uses_while,
         | 
| 575 346 | 
             
                            [:scope,
         | 
| 576 347 | 
             
                             [:block,
         | 
| 577 348 | 
             
                              [:args],
         | 
| 578 | 
            -
                              [: | 
| 579 | 
            -
             | 
| 349 | 
            +
                              [:while, [:vcall, :some_func],
         | 
| 350 | 
            +
                               [:vcall, :some_other_func], true]]]]
         | 
| 580 351 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 581 352 | 
             
              end
         | 
| 582 353 |  | 
| 583 | 
            -
             | 
| 584 | 
            -
             | 
| 585 | 
            -
                expected = [:defn, :uses_boolean,
         | 
| 354 | 
            +
              def test_flips_while_to_until
         | 
| 355 | 
            +
                expected = [:defn, :uses_while,
         | 
| 586 356 | 
             
                            [:scope,
         | 
| 587 357 | 
             
                             [:block,
         | 
| 588 358 | 
             
                              [:args],
         | 
| 589 | 
            -
                              [: | 
| 590 | 
            -
             | 
| 591 | 
            -
             | 
| 592 | 
            -
                @heckler.process(@heckler.current_tree)
         | 
| 593 | 
            -
                assert_equal expected, @heckler.current_tree
         | 
| 594 | 
            -
             | 
| 595 | 
            -
                @heckler.reset_tree
         | 
| 596 | 
            -
             | 
| 597 | 
            -
                # flip both bools from above to true
         | 
| 598 | 
            -
                expected[2][1][2][2][0] = :true
         | 
| 599 | 
            -
                expected[2][1][3][2][0] = :true
         | 
| 600 | 
            -
             | 
| 359 | 
            +
                              [:until, [:vcall, :some_func],
         | 
| 360 | 
            +
                               [:vcall, :some_other_func], true]]]]
         | 
| 601 361 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 602 362 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 603 363 | 
             
              end
         | 
| 604 364 | 
             
            end
         | 
| 605 365 |  | 
| 606 | 
            -
            class  | 
| 607 | 
            -
              def setup
         | 
| 608 | 
            -
                @heckler = Heckle::Base.new("Heckled", "uses_while")
         | 
| 609 | 
            -
              end
         | 
| 610 | 
            -
             | 
| 611 | 
            -
              def teardown
         | 
| 612 | 
            -
                @heckler.reset
         | 
| 613 | 
            -
              end
         | 
| 614 | 
            -
             | 
| 366 | 
            +
            class TestHeckleUntil < HeckleTestCase
         | 
| 615 367 | 
             
              def test_default_structure
         | 
| 616 | 
            -
                expected = [:defn,
         | 
| 617 | 
            -
             | 
| 618 | 
            -
             | 
| 619 | 
            -
             | 
| 620 | 
            -
             | 
| 621 | 
            -
             | 
| 368 | 
            +
                expected = [:defn, :uses_until,
         | 
| 369 | 
            +
                            [:scope,
         | 
| 370 | 
            +
                             [:block,
         | 
| 371 | 
            +
                              [:args],
         | 
| 372 | 
            +
                              [:until, [:vcall, :some_func],
         | 
| 373 | 
            +
                               [:vcall, :some_other_func], true]]]]
         | 
| 622 374 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 623 375 | 
             
              end
         | 
| 624 376 |  | 
| 625 | 
            -
              def  | 
| 626 | 
            -
                expected = [:defn,
         | 
| 627 | 
            -
             | 
| 628 | 
            -
             | 
| 629 | 
            -
             | 
| 630 | 
            -
             | 
| 631 | 
            -
             | 
| 377 | 
            +
              def test_flips_until_to_while
         | 
| 378 | 
            +
                expected = [:defn, :uses_until,
         | 
| 379 | 
            +
                            [:scope,
         | 
| 380 | 
            +
                             [:block,
         | 
| 381 | 
            +
                              [:args],
         | 
| 382 | 
            +
                              [:while, [:vcall, :some_func],
         | 
| 383 | 
            +
                               [:vcall, :some_other_func], true]]]]
         | 
| 632 384 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 633 385 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 634 386 | 
             
              end
         | 
| 635 387 | 
             
            end
         | 
| 636 388 |  | 
| 637 | 
            -
            class  | 
| 389 | 
            +
            class TestHeckleClassMethod < Test::Unit::TestCase
         | 
| 638 390 | 
             
              def setup
         | 
| 639 | 
            -
                @heckler =  | 
| 391 | 
            +
                @heckler = TestHeckler.new("Heckled", "self.is_a_klass_method?")
         | 
| 640 392 | 
             
              end
         | 
| 641 | 
            -
             | 
| 393 | 
            +
              
         | 
| 642 394 | 
             
              def teardown
         | 
| 643 395 | 
             
                @heckler.reset
         | 
| 644 396 | 
             
              end
         | 
| 645 | 
            -
             | 
| 397 | 
            +
              
         | 
| 646 398 | 
             
              def test_default_structure
         | 
| 647 | 
            -
                expected = [:defn,
         | 
| 648 | 
            -
             | 
| 649 | 
            -
             | 
| 650 | 
            -
             | 
| 651 | 
            -
             | 
| 652 | 
            -
                   [:until, [:vcall, :some_func], [:vcall, :some_other_func], true]]]]
         | 
| 399 | 
            +
                expected = [:defn, :"self.is_a_klass_method?",
         | 
| 400 | 
            +
                            [:scope,
         | 
| 401 | 
            +
                             [:block,
         | 
| 402 | 
            +
                              [:args],
         | 
| 403 | 
            +
                              [:true]]]]
         | 
| 653 404 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 654 405 | 
             
              end
         | 
| 655 | 
            -
             | 
| 656 | 
            -
              def  | 
| 657 | 
            -
                expected = [:defn,
         | 
| 658 | 
            -
             | 
| 659 | 
            -
             | 
| 660 | 
            -
             | 
| 661 | 
            -
             | 
| 662 | 
            -
                   [:while, [:vcall, :some_func], [:vcall, :some_other_func], true]]]]
         | 
| 406 | 
            +
              
         | 
| 407 | 
            +
              def test_heckle_class_methods
         | 
| 408 | 
            +
                expected = [:defn, :"self.is_a_klass_method?",
         | 
| 409 | 
            +
                            [:scope,
         | 
| 410 | 
            +
                             [:block,
         | 
| 411 | 
            +
                              [:args],
         | 
| 412 | 
            +
                              [:false]]]]
         | 
| 663 413 | 
             
                @heckler.process(@heckler.current_tree)
         | 
| 664 414 | 
             
                assert_equal expected, @heckler.current_tree
         | 
| 665 415 | 
             
              end
         | 
| 666 416 | 
             
            end
         | 
| 417 | 
            +
             
         | 
| 418 | 
            +
             
         | 
| 419 | 
            +
             
         | 
| 420 | 
            +
             
         | 
| 421 | 
            +
             
         |