From 5360629da0445bdda4d145faf03ee337dec6f1fa Mon Sep 17 00:00:00 2001 From: Bill Rossi Date: Sat, 16 Aug 2025 08:45:52 -0400 Subject: [PATCH] Setup testing --- ika.rb | 2 +- {src => lib}/commands.rb | 0 {src => lib}/commands/command.rb | 0 {src => lib}/commands/help_command.rb | 0 {src => lib}/commands/lesson_command.rb | 0 {src => lib}/commands/stop_lesson_command.rb | 0 {src => lib}/ika.rb | 0 {src => lib}/lesson.rb | 0 {src => lib}/session.rb | 0 {src => lib}/verb.rb | 27 ++++++------ test/test_verb.rb | 44 ++++++++++++++++++++ 11 files changed, 58 insertions(+), 15 deletions(-) rename {src => lib}/commands.rb (100%) rename {src => lib}/commands/command.rb (100%) rename {src => lib}/commands/help_command.rb (100%) rename {src => lib}/commands/lesson_command.rb (100%) rename {src => lib}/commands/stop_lesson_command.rb (100%) rename {src => lib}/ika.rb (100%) rename {src => lib}/lesson.rb (100%) rename {src => lib}/session.rb (100%) rename {src => lib}/verb.rb (84%) create mode 100644 test/test_verb.rb diff --git a/ika.rb b/ika.rb index 94af2d1..996f820 100644 --- a/ika.rb +++ b/ika.rb @@ -1,5 +1,5 @@ require 'discordrb' -require_relative './src/ika' +require_relative './lib/ika' token = File.read("./token") diff --git a/src/commands.rb b/lib/commands.rb similarity index 100% rename from src/commands.rb rename to lib/commands.rb diff --git a/src/commands/command.rb b/lib/commands/command.rb similarity index 100% rename from src/commands/command.rb rename to lib/commands/command.rb diff --git a/src/commands/help_command.rb b/lib/commands/help_command.rb similarity index 100% rename from src/commands/help_command.rb rename to lib/commands/help_command.rb diff --git a/src/commands/lesson_command.rb b/lib/commands/lesson_command.rb similarity index 100% rename from src/commands/lesson_command.rb rename to lib/commands/lesson_command.rb diff --git a/src/commands/stop_lesson_command.rb b/lib/commands/stop_lesson_command.rb similarity index 100% rename from src/commands/stop_lesson_command.rb rename to lib/commands/stop_lesson_command.rb diff --git a/src/ika.rb b/lib/ika.rb similarity index 100% rename from src/ika.rb rename to lib/ika.rb diff --git a/src/lesson.rb b/lib/lesson.rb similarity index 100% rename from src/lesson.rb rename to lib/lesson.rb diff --git a/src/session.rb b/lib/session.rb similarity index 100% rename from src/session.rb rename to lib/session.rb diff --git a/src/verb.rb b/lib/verb.rb similarity index 84% rename from src/verb.rb rename to lib/verb.rb index 971aba5..808c38b 100644 --- a/src/verb.rb +++ b/lib/verb.rb @@ -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 diff --git a/test/test_verb.rb b/test/test_verb.rb new file mode 100644 index 0000000..37c17d8 --- /dev/null +++ b/test/test_verb.rb @@ -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