Better te-form testing
This commit is contained in:
parent
f2caa10be2
commit
60ce9f2690
72
lib/verb.rb
72
lib/verb.rb
@ -61,18 +61,22 @@ class Verb
|
|||||||
dict
|
dict
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def long_form_present_positive
|
||||||
|
stem + "ます"
|
||||||
|
end
|
||||||
|
|
||||||
|
def long_form_present_negative
|
||||||
|
stem + "ません"
|
||||||
|
end
|
||||||
|
|
||||||
def short_form_present_positive
|
def short_form_present_positive
|
||||||
dictionary
|
dictionary
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class IchidanVerb < Verb
|
class IchidanVerb < Verb
|
||||||
def long_form_present_positive
|
def stem
|
||||||
all_but_last_character + "ます"
|
all_but_last_character
|
||||||
end
|
|
||||||
|
|
||||||
def long_form_present_negative
|
|
||||||
all_but_last_character + "ません"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def short_form_present_negative
|
def short_form_present_negative
|
||||||
@ -85,12 +89,12 @@ class IchidanVerb < Verb
|
|||||||
end
|
end
|
||||||
|
|
||||||
class GodanVerb < Verb
|
class GodanVerb < Verb
|
||||||
def long_form_present_positive
|
def iku?
|
||||||
all_but_last_character + last_character("i") + "ます"
|
dict.kanji == "行く"
|
||||||
end
|
end
|
||||||
|
|
||||||
def long_form_present_negative
|
def stem
|
||||||
all_but_last_character + last_character("i") + "ません"
|
all_but_last_character + last_character("i")
|
||||||
end
|
end
|
||||||
|
|
||||||
def short_form_present_negative
|
def short_form_present_negative
|
||||||
@ -98,26 +102,26 @@ class GodanVerb < Verb
|
|||||||
end
|
end
|
||||||
|
|
||||||
def te
|
def te
|
||||||
case last_character
|
all_but_last_character + case last_character
|
||||||
when "う"
|
when "う"
|
||||||
all_but_last_character + "って"
|
"って"
|
||||||
when "る"
|
when "る"
|
||||||
all_but_last_character + "って"
|
"って"
|
||||||
when "つ"
|
when "つ"
|
||||||
all_but_last_character + "って"
|
"って"
|
||||||
when "す"
|
when "す"
|
||||||
all_but_last_character + "して"
|
"して"
|
||||||
when "く"
|
when "く"
|
||||||
all_but_last_character + "いて"
|
iku? ? "って" : "いて"
|
||||||
when "ぐ"
|
when "ぐ"
|
||||||
all_but_last_character + "いで"
|
"いで"
|
||||||
when "ぶ"
|
when "ぶ"
|
||||||
all_but_last_character + "んで"
|
"んで"
|
||||||
when "む"
|
when "む"
|
||||||
all_but_last_character + "んで"
|
"んで"
|
||||||
when "ぬ"
|
when "ぬ"
|
||||||
all_but_last_character + "んで"
|
"んで"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -126,12 +130,8 @@ class SuruVerb < Verb
|
|||||||
dict[..-3]
|
dict[..-3]
|
||||||
end
|
end
|
||||||
|
|
||||||
def long_form_present_positive
|
def stem
|
||||||
prefix + "します"
|
prefix + "し"
|
||||||
end
|
|
||||||
|
|
||||||
def long_form_present_negative
|
|
||||||
prefix + "しません"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def short_form_present_negative
|
def short_form_present_negative
|
||||||
|
@ -5,6 +5,16 @@ class TestVerb < Minitest::Test
|
|||||||
def setup
|
def setup
|
||||||
@miru = IchidanVerb.new("見る", "みる", "to look")
|
@miru = IchidanVerb.new("見る", "みる", "to look")
|
||||||
@nomu = GodanVerb.new("飲む", "のむ", "to drink")
|
@nomu = GodanVerb.new("飲む", "のむ", "to drink")
|
||||||
|
@au = GodanVerb.new("会う", "あう", "to meet")
|
||||||
|
@matsu = GodanVerb.new("待つ", "まつ", "to wait")
|
||||||
|
@toru = GodanVerb.new("取る", "とる", "to take")
|
||||||
|
@yomu = GodanVerb.new("読む", "よむ", "to read")
|
||||||
|
@asobu = GodanVerb.new("遊ぶ", "あそぶ", "to play")
|
||||||
|
@shinu = GodanVerb.new("死ぬ", "しぬ", "to die")
|
||||||
|
@kaku = GodanVerb.new("書く", "かく", "to write")
|
||||||
|
@iku = GodanVerb.new("行く", "いく", "to go")
|
||||||
|
@oyogu = GodanVerb.new("泳ぐ", "およぐ", "to swim")
|
||||||
|
@hanasu = GodanVerb.new("話す", "はなす", "to speak")
|
||||||
@suru = SuruVerb.new("する", "する", "to do")
|
@suru = SuruVerb.new("する", "する", "to do")
|
||||||
@benkyousuru = SuruVerb.new("勉強する", "べんきょうする", "to study")
|
@benkyousuru = SuruVerb.new("勉強する", "べんきょうする", "to study")
|
||||||
end
|
end
|
||||||
@ -18,6 +28,16 @@ class TestVerb < Minitest::Test
|
|||||||
assert_equal "して", @suru.te.kana
|
assert_equal "して", @suru.te.kana
|
||||||
assert_equal "勉強して", @benkyousuru.te.kanji
|
assert_equal "勉強して", @benkyousuru.te.kanji
|
||||||
assert_equal "べんきょうして", @benkyousuru.te.kana
|
assert_equal "べんきょうして", @benkyousuru.te.kana
|
||||||
|
assert_equal "会って", @au.te.kanji
|
||||||
|
assert_equal "待って", @matsu.te.kanji
|
||||||
|
assert_equal "取って", @toru.te.kanji
|
||||||
|
assert_equal "読んで", @yomu.te.kanji
|
||||||
|
assert_equal "遊んで", @asobu.te.kanji
|
||||||
|
assert_equal "死んで", @shinu.te.kanji
|
||||||
|
assert_equal "書いて", @kaku.te.kanji
|
||||||
|
assert_equal "行って", @iku.te.kanji
|
||||||
|
assert_equal "泳いで", @oyogu.te.kanji
|
||||||
|
assert_equal "話して", @hanasu.te.kanji
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_long_form_present_positive
|
def test_long_form_present_positive
|
||||||
|
Loading…
Reference in New Issue
Block a user