Upgrade to Pro — share decks privately, control downloads, hide ads and more …

cookpad 2015 summer internship TDD

cookpad 2015 summer internship TDD

Yoshiori SHOJI

August 20, 2015
Tweet

More Decks by Yoshiori SHOJI

Other Decks in Technology

Transcript

  1. git • βοΫϦݴ͑͹ॻ͍ͨιʔείʔυͷཤྺΛ؅ཧͯ͘͠ΕΔιϑτ • ࠷ॳ͸ΤσΟλͷ undo ͷੌ͍΍ͭͩͱࢥͬͯஔ͚͹ • ศརͳͷͰ༨༟͕Ͱ͖ͨΒ৭ʑௐ΂͓֮ͯ͑ͯ͘ͱྑ͍ •

    github ͱ͔ฉ͍ͨ͜ͱ͋Δͱࢥ͏͚ͲɺͱΓ͋͑ͣؾʹ͢ΔͳɻWiki ͱ Wikipedia ͘Β ͍ͷҧ͍͕͋Δ • ʢ׬શʹؔ܎ͳ͍ͱ͸ݴΘͳ͍͕ಉҰࢹͯ͠͸͍͚ͳ͍ʣ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 3
  2. git ͱΓ֮͋͑ͣ͑Δ΂͖ίϚϯυ - add - มߋΛ൓өͤ͞Δ - commit - ൓өͨ͠มߋΛอଘ͢Δ

    - push - ϦϞʔτʹஔ͘ - pull - ϦϞʔτ͔Β࣋ͬͯ͘Δ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 4
  3. ՝୊: ԕ͍ੈքͷ਺ࣜ1 ܅ͷ஌Βͳ͍ԕ͍ੈքͷ਺ࣜΛධՁͯ͠΋Β͏ɻ ਺ࣜ͸ 4*5+6&7|8 ͷΑ͏ͳܗʹͳ͍ͬͯΔɻ ۮવʹ΋ɺ ԋࢉࢠͷҙຯ͸ ruby ͷ֤ԋࢉࢠͷҙຯͱಉ͡ͳΜ͚ͩͲɺ༏ઌॱҐ͸

    ruby ͱ͸ҟͳΔͷͰͦͷ·· eval ͢ΔΘ͚ʹ͸͍͔ͳ͍ɻ ԋࢉࢠͷ༏ઌॱҐ͸Լදͷ௨ΓɻҰԠҙຯ΋ॻ͍͚ͨͲɺҙຯ͸ ruby ͱಉ͡ɻ ↑ ༏ઌॱҐߴ | Ϗοτ or & Ϗοτ and + Ճࢉ * ৐ࢉ ↓ ༏ઌॱҐ௿ 1 http://nabetani.sakura.ne.jp/kanagawa.rb/evalex/ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 10
  4. ·ͣ͸؀ڥͷ֬ೝ calculator_spec.rb describe "calculator" do it { expect(true).to be true

    } end ࣮ߦͯ͠ΈΑ͏ $ rspec calculator_spec.rb calculator should equal true Finished in 0.00191 seconds (files took 0.19241 seconds to load) 1 example, 0 failures 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 11
  5. ·ͣ͸؀ڥͷ֬ೝ ͜ΕʹΑͬͯ෼͔Δ͜ͱ 1. rspec ίϚϯυʹ path ͕௨͍ͬͯΔ 1. ·ͣ͸؀ڥͷςετʹͳΔ 2.

    ࣮͸؀ڥ͕੔͍ͬͯͳ͍ͱ͔Α͋͘Δ 2. ࣮ࡍʹ࣮ߦͯ͠ΤϥʔʹͳΒͳ͍ 1. ϕʔεͷίʔυ͕ؒҧ͍͑ͯͳ͍ࣄ͕Θ͔Δ 2. ࣮͸ผͷϑΝΠϧ࣮ߦͯͨ͠ͱ͔Α͋͘Δ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 12
  6. ·ͣ͸؀ڥͷ֬ೝ ͜͜ͰҰ୴ίϛοτ $ git init Initialized empty git repository in

    /path/to/your/dir/.git/ $ git add calculator_spec.rb $ git commit -m "init" [master (root-commit) 1f3ad9b] init 1 file changed, 3 insertions(+) create mode 100644 calculator_spec.rb 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 13
  7. ͔͜͜Β͖͞͸جຊతʹ • ςετ͕ green • ࣮૷ίʔυͷϦϑΝΫλϦϯά͔ςετίʔυͷ ௥Ճ ͷ Έ •

    ςετ͕ red • ࣮૷ίʔυ͔͠࿔Βͳ͍ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 14
  8. ͔͜͜Β͖͞͸جຊతʹ • άνϟάνϟʹͳͬͯΑ͘෼͔Βͳ͘ͳͬͨΒ • git reset --hard HEAD • Ͱɺίϛοτͨ͠ͱ͜Ζ·Ͱ໭ͤ·͢

    • ࠓճ͸ Path ͱ͔Ͱ೰Ήͷຊ࣭Ͱ͸ͳ͍ͷͰҰͭͷϑΝΠϧͰ ΍Γ·͢ • ී௨͸ςετίʔυͱ࣮૷ίʔυͷϑΝΠϧΛΘ͚·͢ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 15
  9. ࠷ॳͷ࣮૷ ·ͣ͸ςετΛίέͤ͞Δ describe "calculator" do it "15*5 = 75" do

    expect(calc("15*5")).to eq 75 end end ࣮ߦͯ͠ΈΔͱίέ·͢ɻ ʮcalc ͳΜͯϝιουແ͍ΑʯͱౖΒΕΔͷͰ calc ͱ͍͏ϝιουΛ࣮ ૷ͯ͠Έ·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 16
  10. ࠷ॳͷ࣮૷ red ʹͳͬͨͷͰ࣮૷ίʔυΛ࿔Δ ςετ͕௨ΔΑ͏ʹ def calc(expression) 75 end describe "calculator"

    do it "15*5 = 75" do expect(calc("15*5")).to eq 75 end end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 17
  11. ࠷ॳͷ࣮૷ ͜ΕʹΑͬͯ෼͔Δ͜ͱ Ծ࣮૷ ͱ͍ΘΕͨΓ͢Δ 1. green ʹͳΔ͜ͱΛ֬ೝ͢Δ • ظ଴͍ͯ͠Δͱ͓Γʹςετ͕ಈ͍͍ͯΔ͜ͱͷ֬ೝ •

    ςετίʔυͷςετʹͳΔ 2. ࣗ෼͕ฤू͍ͯ͠ΔϑΝΠϧʹؒҧ͍ͳ͍ • ࣗ෼͕৮ͬͯΔϑΝΠϧΛצҧ͍ͯ͠Δͱ͔Α͋͘Δ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 19
  12. Q.1 ϦϑΝΫλϦϯά Ծ࣮૷Ͱ͸ͳ࣮͘ࡍͷ࣮૷Λͯ͠Έ·͠ΐ͏ʢ5 ෼ʣ def calc(expression) # ίίʹ࣮૷Λॻ͘ end describe

    "calculator" do it "15*5 = 75" do expect(calc("15*5")).to eq 75 end end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 21
  13. ࠷ॳͷ࣮૷ ྫ def calc(expression) result = nil expression.scan(/\d+/).each do|num| if

    result result = result * num.to_i else result = num.to_i end end result end • green ΛΩʔϓ͍ͯ͠Δ͜ͱ • ઈରʹςετίʔυΛ࿔Βͳ͍ • ඞཁҎ্ͷࣄ͸͠ͳ͍ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 22
  14. ࠷ॳͷ࣮૷ ͜͜Ͱ ίϛοτ $ git add -p ϦϑΝΫλϦϯάͨ͠෼͚ͩͳͷΛ֬ೝ $ git

    commit --amend Ծ࣮૷ͷίϛοτʹ্ॻ͖ͯ͠ίϛοτ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 23
  15. ࣍ͷ࣮૷ ςετΛ·ͣ௥Ճ͠·͢ describe "calculator" do it "15*5 = 75" do

    expect(calc("15*5")).to eq 75 end it "15+5 = 20" do expect(calc("15+5")).to eq 20 end end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 24
  16. ࣍ͷ࣮૷ 1) calculator 15+5 = 20 Failure/Error: expect(calc("15+5")).to eq 20

    expected: 20 got: 75 (compared using ==) # ./calculator_spec.rb:11:in `block (2 levels) in <top (required)>' 15 + 5 Ͱ 20 Λظ଴͚ͨ͠Ͳ 75 ͕ฦ͖ͬͯͨͱݴ͍ͬͯ·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 25
  17. ࣍ͷ࣮૷ ͜ΕʹΑͬͯ෼͔Δ͜ͱ 1. ৽͍͠མͪΔςετΛ௥Ճ - ςετίʔυͷςετ - ͜Ε͕མͪͳ͔ͬͨΒΦΧγΠ 2. ݩͷςετ͸੒ޭ͍ͯ͠Δ͜ͱΛ֬ೝ

    - ଞΛյ͍ͯ͠ͳ͍͜ͱΛอূ 15 + 5 Ͱ 20 Λظ଴͚ͨ͠Ͳ 75 ͕ฦ͖ͬͯͨͱݴΘΕͨͷͰ 20 ͕ฦΔ Α͏ʹ͠·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 26
  18. ࣍ͷ࣮૷ ·ͨԾ࣮૷Λ͠·͢ def calc(expression) result = nil expression.scan(/\d+/).each do|num| if

    result if expression.include?("*") result = result * num.to_i else result = result + num.to_i end else result = num.to_i end end result end ࠓ౓͸ςετ௨Γ·͢ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 27
  19. ࣍ͷ࣮૷ ϦϑΝΫλϦϯάྫ def calc(expression) result = nil op = expression.scan(/\*|\+/).first

    expression.scan(/\d+/).each do|num| if result case op when "*" result = result * num.to_i else result = result + num.to_i end else result = num.to_i end end result end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 29
  20. ୤ઢ: Ruby ͷ࿩ "15+5".scan(/\d+/) #=> ["15", "5"] "15+5".send("scan", /\d+/) #=>

    ["15", "5"] ϝιουݺͼग़͠͸ send ϝιουʹจࣈྻͰϝιου໊Λ౉ ͢͜ͱͰߦ͏͜ͱ΋ग़དྷ·͢ɻ(ϝιουͷҾ਺͸ୈೋҾ਺Ҏ߱ ʹฒ΂·͢ʣ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 30
  21. ୤ઢ: Ruby ͷ࿩ 10 + 5 #=> 15 10.+(5) #=>

    15 ԋࢉࢠ΋࣮͸ϝιουͰ͢ɻʢ਺ࣈͷΦϒδΣΫτʹରͯ͠ + ͬͯϝιουΛݺΜͰ͍·͢ʣ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 31
  22. ୤ઢ: Ruby ͷ࿩ ίϨΛ૊Έ߹Θͤͯߟ͑Δͱ 10 + 5 #=> 15 ͸

    10.send("+",5) #=> 15 ͬͯॻ͚·͢ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 32
  23. ୤ઢ: Ruby ͷ࿩ ͱ͍͏͜ͱ͸ case op when "*" result =

    result * num.to_i else result = result + num.to_i end ͱॻ͍ͨ෦෼͸ result = result.send(op, num.to_i) ͱॻ͚·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 33
  24. ୤ઢ: Ruby ͷ࿩ def calc(expression) result = nil op =

    expression.scan(/\*|\+/).first expression.scan(/\d+/).each do|num| if result result = result.send(op, num.to_i) else result = num.to_i end end result end ςετ͕௨ͬͯΔ͜ͱΛ֬ೝͯ͠ίϛοτ͠·͠ΐ͏ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 34
  25. ୤ઢ: Ruby ͷ࿩ Array#map ͱ͍͏ཁૉͷ਺͚ͩ܁Γฦ͠ϒϩοΫΛ࣮ߦͯ͠ϒ ϩοΫͷ໭Γ஋ΛूΊͨ഑ྻΛ࡞੒ͯ͠ฦ͢ϝιου͕͋Γ· ͢ɻ [1, 2, 3].map

    {|i| i + 5 } #=> [6, 7, 8] ["1", "2", "3"].map {|i| i.to_i } #=> [1, 2, 3] 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 35
  26. ୤ઢ: Ruby ͷ࿩ ͦͯ͠୯७ͳϝιουݺͼग़͠ͷ࣌͸ ["1", "2", "3"].map {|i| i.to_i }

    #=> [1, 2, 3] ["1", "2", "3"].map(&:to_i) #=> [1, 2, 3] ͱॻ͚·͢3ɻ 3 Կނͦ͏ͳΔͷ͔ڵຯͷ͋Δਓ͸ Symbol#to_proc Λௐ΂ͯΈ·͠ΐ͏ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 36
  27. ୤ઢ: Ruby ͷ࿩ def calc(expression) result = nil op =

    expression.scan(/\*|\+/).first expression.scan(/\d+/).map(&:to_i).each do|num| if result result = result.send(op, num) else result = num end end result end ςετ͕௨ͬͯΔ͜ͱΛ֬ೝͯ͠ίϛοτ͠·͠ΐ͏ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 38
  28. ୤ઢ: Ruby ͷ࿩ ͞Βʹ͖ͬ͞ग़͖ͯͨ map ͱಉ͘͡ ["1", "2", "3"].map {|i|

    i.to_i } #=> [1, 2, 3] ["1", "2", "3"].map(&:to_i) #=> [1, 2, 3] ↓ ͷΑ͏ʹॻ͚·͢ [1, 2, 3].inject {|sum, num| sum + num } #=> 6 [1, 2, 3].inject(&:+) #=> 6 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 40
  29. ໌നͳ࣮૷ ࠓͷ࣮૷Ͱ "15&5" ͱ "15|5" ʹ΋؆୯ʹରԠͰ͖ͦ͏Ͱ͢ɻ ͜͏͍͏࣌͸Ծ࣮૷Λল͍࣮ͯ૷ͯ͠͠·͍·͠ΐ͏ɻ ΍͸Γ·ͣ͸ςετΛॻ͖·͢ it "15&5

    = 5" do expect(calc("15&5")).to eq 5 end it "15|5 = 15" do expect(calc("15|5")).to eq 15 end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 42
  30. ߋʹ࣍΁ Ծ࣮૷͠·͢ def calc(expression) return 225 if expression == "30+15*5"

    op = expression.scan(/\*|\+|\&|\|/).first expression.scan(/\d+/).map(&:to_i).inject(&op.to_sym) end ςετ͕௨Δ͜ͱΛ֬ೝ͠·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 49
  31. ׬੒΁ ࣍ͷ࣮૷Λߟ͑ͯΈ·͠ΐ͏…… it "30*15+5 = 600" do expect(calc("30*15+5")).to eq 600

    end ͪΐͬͱ 5 ෼΄ͲɺίϨ͕௨ΔΑ͏ʹߟ͑ͯΈ͍ͯͩ͘͞ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 52
  32. ׬੒΁ Ͳ͏΍Βࠓ·ͰͷΑ͏ʹ୯७ʹϧʔϓॲཧʹ೚ͤͯܭࢉ͢ΔͷͰ͸͏·͘ߦ͔ ͳͦ͏Ͱ͢ɻ Ұ୴΋͏ͪΐͬͱ؆୯ͳςετ͔Β࢝Ίͨ΄͏͕ྑͦ͞͏Ͱ͢ɻ ͜ͷςετ͸ pending ʹ͠·͢ɻ it "30*15+5 =

    600" do pending("unimplemented") expect(calc("30*15+5")).to eq 600 end ࣮ߦͯ͠ pending ʹͳ͍ͬͯΔ͜ͱΛ֬ೝ͠·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 53
  33. ׬੒΁ ۩ମతʹ͸Ͳ͏΍ͬͯܭࢉ͍ͯ͘͠ͷ͔ߟ͑ͯΈ·͢ɻ 30*15+5 -> 30*20 -> 600 ϓϩάϥϜͰѻ͏ࣄΛߟ͑ͯ Array ʹͯ͠

    ["30", "*", "15", "+", "5"] ["30", "*", "20"] ["600"] ͱܭࢉ͍ͯ͘͠Α͏ʹ͢Ε͹ྑͦ͞͏Ͱ͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 54
  34. ׬੒΁ ͱΓ͋͑ͣ࠷ॳͷҰาΛผͷϝιουͰ࣮૷ͯ͠Έ·͠ΐ͏ɻ it "30*15+5 -> 30*20" do expect(_calc(["30", "*", "15",

    "+", "5"])).to eq ["30", "*", "20"] end ্هΛ௨ΔΑ͏ͳίʔυΛ·ͣ͸ॻ͍ͯΈ·͠ΐ͏ɻ ʢ5෼ ׬੒͠ͳͯ͘΋͍͍Ͱ͢ʣ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 55
  35. ׬੒΁ టष͘ॻ͍ͯΈ·ͨ͠ def _calc(expressions) pos = expressions.index("+") operator = expressions[pos]

    left = expressions[pos-1].to_i right = expressions[pos+1].to_i res = left.send(operator, right) expressions[pos-1..pos+1] = res.to_s expressions end ͜ͷॲཧΛԋࢉࢠͷ༏ઌ౓ॱʹߦ͑͹ग़དྷͦ͏Ͱ͢ɻ ͱΓ͋͑ͣίϛοτ͓͖ͯ͠·͢ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 56
  36. ׬੒΁ Q.2 ઌ΄Ͳͷ pending ʹͨ͠ςετ͕௨Δ4Α͏ʹ ࣮૷Λͯ͠Έ·͠ΐ͏ʢ45 ෼ʣ it "30*15+5 =

    600" do pending("unimplemented") expect(calc("30*15+5")).to eq 600 end ͍͖ͳΓ্هςετ௨ΔΑ͏ʹ͢ΔͷͰ͸ͳ͘ ͖ͬ͞ͷΑ͏ʹগͮͭ͠ςετΛॻ͍ͯҰาͮͭਐΜͰΈ·͠ΐ͏ɻ 4 ϖϯσΟϯάʹ͍ͯͨ͠ςετ͕௨Δͱ΋͏ϖϯσΟϯάͰ͸ͳ͍ͱදͨ͢Ίʹ੺͘ͳΔͷͰ pending Λফ͠·͠ΐ͏ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 57
  37. ͕࣍શͯ௨ΔࣄΛ֬ೝͯ͠Έ·͠ΐ͏2 describe "all" do it do [ [ 0, "4*5+6&7|8",

    "44" ], [ 1, "15*5", "75" ], [ 2, "15+5", "20" ], [ 3, "15&5", "5" ], [ 4, "15|5", "15" ], [ 5, "30*15*5", "2250" ], [ 6, "30*15+5", "600" ], [ 7, "30*15&5", "150" ], [ 8, "30*15|5", "450" ], [ 9, "30+15*5", "225" ], [ 10, "30+15+5", "50" ], [ 11, "30+15&5", "35" ], [ 12, "30+15|5", "45" ], [ 13, "30&15*5", "70" ], [ 14, "30&15+5", "19" ], [ 15, "30&15&5", "4" ], [ 16, "30&15|5", "14" ], [ 17, "30|15*5", "155" ], [ 18, "30|15+5", "36" ], [ 19, "30|15&5", "5" ], [ 20, "30|15|5", "31" ], [ 21, "1+2+3+4+5+6+7+8+9+10", "55" ], [ 22, "1*2*3*4*5*6*7*8*9*10", "3628800" ], [ 23, "1+2+3+4+5*6+7+8+9+10", "600" ], [ 24, "1*2*3*4*5+6*7*8*9*10", "1330560" ], [ 25, "1|2|4|8|16|32|64|128|256|512", "1023" ], [ 26, "2046&2045&2043&2039&2031&2015&1983&1919&1791&1535", "1024" ], [ 27, "0+1|7*6", "42" ], [ 28, "6|4+2&9+4", "10" ], [ 29, "0&6+1&6|4*2", "0" ], [ 30, "4|4*7+7+4&9", "56" ], [ 31, "9&8*2+3*1|2|7", "280" ], [ 32, "230+83*751&176", "50080" ], [ 33, "89+62465*94&84", "5254536" ], [ 34, "668&925+398*562", "599092" ], [ 35, "15|9+348*302&23&77", "1452" ], [ 36, "3&3&6|7+3|5*3|2&4*4", "0" ], [ 37, "7*6|7|7*1&7|7&3&8*3", "0" ], [ 38, "896+316*209*264&728", "2026464" ], [ 39, "1844+41*64|7906|66842", "138965970" ], [ 40, "2&41&6884*69857+68083", "0" ], [ 41, "2+3*9*3|6|7&0+3+3*6&8", "0" ], [ 42, "895+400*988|549&237+488", "938875" ], [ 43, "30*48&99036+140&33+75|645", "22050" ], [ 44, "278+2033+53*96*56|3303|3&14", "3177216" ], [ 45, "5380&27|643*2+1888&74+30|16", "0" ], [ 46, "0&3845+6645*4293+78&78*3102|9|3", "90127550385" ], [ 47, "78&44956&67*974|413+13237*5588|54*668", "0" ], [ 48, "500*206+145|167|163|465&668+662+806*681&458", "123896000" ], [ 49, "82+14&0*344+34+542916&18*11|844|64*873223|840993", "23813260003764" ], [ 50, "374958|6727+53965&53*954&29|6*138572+59|547783&43*8998", "12178274756590800" ], ].each do |q| expect(calc(q[1])).to eq q[2].to_i end end 2 https://gist.github.com/yoshiori/87238f1e229baab94a7b 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 58
  38. ྫ def calc(expression) result = expression.scan(/\*|\+|\&|\||\d+/) %w(| & + *).each

    do |op| while result.include? op pos = result.index(op) res = result[pos-1].to_i.send(op, result[pos+1].to_i) result[pos-1..pos+1] = res end end result.first end 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 59
  39. ࠷ॳʹग़͞Ε͓ͨ୊ ܅ͷ஌Βͳ͍ԕ͍ੈքͷ਺ࣜΛධՁͯ͠΋Β͏ɻ ਺ࣜ͸ 4*5+6&7|8 ͷΑ͏ͳܗʹͳ͍ͬͯΔɻ ۮવʹ΋ɺԋࢉࢠͷҙຯ ͸ ruby ͷ֤ԋࢉࢠͷҙຯͱಉ͡ͳΜ͚ͩͲɺ༏ઌॱҐ͸ ruby

    ͱ͸ҟͳΔͷͰͦͷ·· eval ͢ΔΘ͚ʹ͸͍͔ͳ͍ɻ ԋࢉࢠͷ ༏ઌॱҐ͸Լදͷ௨ΓɻҰԠҙຯ΋ॻ͍͚ͨͲɺҙຯ͸ ruby ͱ ಉ͡ɻ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 60
  40. TDD ͓͞Β͍ • ςετ͕૝ఆ௨Γ͔֬ೝ͢Δ͜ͱ͕େࣄ • red ͕ѱ͍ɺgreen ͕ྑ͍ͷͰ͸ͳ͍ • red

    ʹͳΔ΂͖ςετ͕ red ʹͳΓɺgreen ʹͳΔ΂͖ςετ͕ green ʹͳ͍ͬͯΔ͜ͱ͕େࣄ • ͦΕΛૉૣ֬͘ೝ͢ΔͨΊͷԾ࣮૷ • ςετίʔυͷςετʹͳΔ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 63
  41. TDD ͓͞Β͍ 1. ࠷ॳʹ red ʹ͢Δ 2. ࠷଎Ͱ green ʹ͢Δ

    • ͜͜·Ͱ͸ςετίʔυͷςετ 3. ϦϑΝΫλϦϯά͢Δ • ͕͜͜ຊؾͷ࣮૷ • ଟ෼ΈΜͳ͕ීஈ૝૾͢Δʢେن໛ͳʣϦϑΝΫλϦϯάͱ͸গ͠ײ͕֮ҧ͏ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 64
  42. ·ͱΊ 1. େ͖͍໰୊Λখ͘͞෼ׂ͢Δ 2. ໰୊Λ 1 ͭͣͭղ͍͍ͯ͘ 3. ͦΕΛ㕩͍ͯ͘͠ 1.

    ·ͣ͸མͪΔςετΛॻ͘ 2. ςετ͕௨ΔҰ൪؆୯ͳ࣮૷Λॻ͘ʢԾ࣮૷ɺ໌നͳ࣮૷ʣ 3. ϦϑΝΫλϦϯά͢Δ 2015/08/20 TDD ͱ git Ͱ㕩Δ։ൃ 66