Setup testing
This commit is contained in:
		
							parent
							
								
									8552a95bb7
								
							
						
					
					
						commit
						5360629da0
					
				
							
								
								
									
										2
									
								
								ika.rb
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								ika.rb
									
									
									
									
									
								
							| @ -1,5 +1,5 @@ | |||||||
| require 'discordrb' | require 'discordrb' | ||||||
| require_relative './src/ika' | require_relative './lib/ika' | ||||||
| 
 | 
 | ||||||
| token = File.read("./token") | token = File.read("./token") | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -67,6 +67,10 @@ class IchidanVerb < Verb | |||||||
|     all_but_last_character + "ます" |     all_but_last_character + "ます" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def long_form_present_negative | ||||||
|  |     all_but_last_character + "ません" | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   def te |   def te | ||||||
|     all_but_last_character + "て" |     all_but_last_character + "て" | ||||||
|   end |   end | ||||||
| @ -77,8 +81,11 @@ class GodanVerb < Verb | |||||||
|     all_but_last_character + last_character("i") + "ます" |     all_but_last_character + last_character("i") + "ます" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def long_form_present_negative | ||||||
|  |     all_but_last_character + last_character("i") + "ません" | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|   def te |   def te | ||||||
|     p last_character |  | ||||||
|     case last_character |     case last_character | ||||||
|     when "う" |     when "う" | ||||||
|       all_but_last_character + "って" |       all_but_last_character + "って" | ||||||
| @ -111,21 +118,13 @@ class SuruVerb < Verb | |||||||
|     prefix + "します" |     prefix + "します" | ||||||
|   end |   end | ||||||
| 
 | 
 | ||||||
|  |   def long_form_present_negative | ||||||
|  |     prefix + "しません" | ||||||
|  |   end | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|   def te |   def te | ||||||
|     prefix + "して" |     prefix + "して" | ||||||
|   end |   end | ||||||
| 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
									
								
							
							
						
						
									
										44
									
								
								test/test_verb.rb
									
									
									
									
									
										Normal 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 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user