diff --git a/lib/verb.rb b/lib/verb.rb index 808c38b..2fd2f5f 100644 --- a/lib/verb.rb +++ b/lib/verb.rb @@ -60,6 +60,10 @@ class Verb def dictionary dict end + + def short_form_present_positive + dictionary + end end class IchidanVerb < Verb @@ -71,6 +75,10 @@ class IchidanVerb < Verb all_but_last_character + "ません" end + def short_form_present_negative + all_but_last_character + "ない" + end + def te all_but_last_character + "て" end @@ -85,6 +93,10 @@ class GodanVerb < Verb all_but_last_character + last_character("i") + "ません" end + def short_form_present_negative + all_but_last_character + last_character("a") + "ない" + end + def te case last_character when "う" @@ -122,6 +134,9 @@ class SuruVerb < Verb prefix + "しません" end + def short_form_present_negative + prefix + "しない" + end def te prefix + "して" diff --git a/test/test_verb.rb b/test/test_verb.rb index 37c17d8..c2770c1 100644 --- a/test/test_verb.rb +++ b/test/test_verb.rb @@ -41,4 +41,26 @@ class TestVerb < Minitest::Test assert_equal "勉強しません", @benkyousuru.long_form_present_negative.kanji assert_equal "べんきょうしません", @benkyousuru.long_form_present_negative.kana end + + def test_short_form_present_positive + assert_equal "見る", @miru.short_form_present_positive.kanji + assert_equal "みる", @miru.short_form_present_positive.kana + assert_equal "飲む", @nomu.short_form_present_positive.kanji + assert_equal "のむ", @nomu.short_form_present_positive.kana + assert_equal "する", @suru.short_form_present_positive.kanji + assert_equal "する", @suru.short_form_present_positive.kana + assert_equal "勉強する", @benkyousuru.short_form_present_positive.kanji + assert_equal "べんきょうする", @benkyousuru.short_form_present_positive.kana + end + + def test_short_form_present_negative + assert_equal "見ない", @miru.short_form_present_negative.kanji + assert_equal "みない", @miru.short_form_present_negative.kana + assert_equal "飲まない", @nomu.short_form_present_negative.kanji + assert_equal "のまない", @nomu.short_form_present_negative.kana + assert_equal "しない", @suru.short_form_present_negative.kanji + assert_equal "しない", @suru.short_form_present_negative.kana + assert_equal "勉強しない", @benkyousuru.short_form_present_negative.kanji + assert_equal "べんきょうしない", @benkyousuru.short_form_present_negative.kana + end end