Setup testing

This commit is contained in:
Bill Rossi 2025-08-16 08:45:52 -04:00
parent 8552a95bb7
commit 5360629da0
11 changed files with 58 additions and 15 deletions

2
ika.rb
View File

@ -1,5 +1,5 @@
require 'discordrb'
require_relative './src/ika'
require_relative './lib/ika'
token = File.read("./token")

View File

@ -67,6 +67,10 @@ class IchidanVerb < Verb
all_but_last_character + "ます"
end
def long_form_present_negative
all_but_last_character + "ません"
end
def te
all_but_last_character + ""
end
@ -77,8 +81,11 @@ class GodanVerb < Verb
all_but_last_character + last_character("i") + "ます"
end
def long_form_present_negative
all_but_last_character + last_character("i") + "ません"
end
def te
p last_character
case last_character
when ""
all_but_last_character + "って"
@ -111,21 +118,13 @@ class SuruVerb < Verb
prefix + "します"
end
def long_form_present_negative
prefix + "しません"
end
def te
prefix + "して"
end
end
= IchidanVerb.new("見る", "みる", "to look")
= GodanVerb.new("飲む", "のむ", "to drink")
= SuruVerb.new("する", "する", "to do")
= SuruVerb.new("勉強する", "べんきょうする", "to study")
verbs = [,,,]
verbs.each do |verb|
p verb.dictionary.kanji
p verb.dictionary.kana
p verb.long_form_present_positive.kanji
p verb.long_form_present_positive.kana
p verb.te.kanji
p verb.te.kana
end

44
test/test_verb.rb Normal file
View File

@ -0,0 +1,44 @@
require_relative "../lib/verb"
require "minitest/autorun"
class TestVerb < Minitest::Test
def setup
@miru = IchidanVerb.new("見る", "みる", "to look")
@nomu = GodanVerb.new("飲む", "のむ", "to drink")
@suru = SuruVerb.new("する", "する", "to do")
@benkyousuru = SuruVerb.new("勉強する", "べんきょうする", "to study")
end
def test_te_form
assert_equal "見て", @miru.te.kanji
assert_equal "みて", @miru.te.kana
assert_equal "飲んで", @nomu.te.kanji
assert_equal "のんで", @nomu.te.kana
assert_equal "して", @suru.te.kanji
assert_equal "して", @suru.te.kana
assert_equal "勉強して", @benkyousuru.te.kanji
assert_equal "べんきょうして", @benkyousuru.te.kana
end
def test_long_form_present_positive
assert_equal "見ます", @miru.long_form_present_positive.kanji
assert_equal "みます", @miru.long_form_present_positive.kana
assert_equal "飲みます", @nomu.long_form_present_positive.kanji
assert_equal "のみます", @nomu.long_form_present_positive.kana
assert_equal "します", @suru.long_form_present_positive.kanji
assert_equal "します", @suru.long_form_present_positive.kana
assert_equal "勉強します", @benkyousuru.long_form_present_positive.kanji
assert_equal "べんきょうします", @benkyousuru.long_form_present_positive.kana
end
def test_long_form_present_negative
assert_equal "見ません", @miru.long_form_present_negative.kanji
assert_equal "みません", @miru.long_form_present_negative.kana
assert_equal "飲みません", @nomu.long_form_present_negative.kanji
assert_equal "のみません", @nomu.long_form_present_negative.kana
assert_equal "しません", @suru.long_form_present_negative.kanji
assert_equal "しません", @suru.long_form_present_negative.kana
assert_equal "勉強しません", @benkyousuru.long_form_present_negative.kanji
assert_equal "べんきょうしません", @benkyousuru.long_form_present_negative.kana
end
end