From fb6091eb654298501adead28acec06e3ebdacced Mon Sep 17 00:00:00 2001 From: LFDM <1986gh@gmail.com> Date: Wed, 13 Aug 2014 20:30:01 +0200 Subject: [PATCH] Fix sexus error with adjectives --- lib/llt/form_builder/adjective_builder.rb | 2 +- .../llt/form_builder/adjective_builder_spec.rb | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/llt/form_builder/adjective_builder.rb b/lib/llt/form_builder/adjective_builder.rb index cb487aa..2b2f6cf 100644 --- a/lib/llt/form_builder/adjective_builder.rb +++ b/lib/llt/form_builder/adjective_builder.rb @@ -12,7 +12,7 @@ def init_keys end def nominatives - res = [[@nom, 1, 1]] + res = [[@nom, 1, 1, :m]] if @number_of_endings == 1 && @inflection_class == 3 res += [[@nom, 1, 1, :f], [@nom, 1, 1, :n]] end diff --git a/spec/lib/llt/form_builder/adjective_builder_spec.rb b/spec/lib/llt/form_builder/adjective_builder_spec.rb index 439e1ba..28999a3 100644 --- a/spec/lib/llt/form_builder/adjective_builder_spec.rb +++ b/spec/lib/llt/form_builder/adjective_builder_spec.rb @@ -36,6 +36,7 @@ def with_adjective(options) amicus.casus.should == 1 amicus.numerus.should == 1 amicus.sexus.should == :m + amicus.inflection_class.should == 1 amico.casus.should == 6 amico.numerus.should == 1 @@ -52,12 +53,24 @@ def with_adjective(options) it "builds all forms of A/O like pulcher" do args = [{type: :adjective, nominative: "pulcher", stem: "pulchr", inflection_class: 1, number_of_endings: 3, comparatio: :positivus}] - form_builder_strings(args).should ==%w{pulcher pulchri pulchro pulchrum pulcher pulchro pulchri pulchrorum pulchris pulchros pulchri pulchris + forms = LLT::FormBuilder.build(*args) + forms.map(&:to_s).should == %w{pulcher pulchri pulchro pulchrum pulcher pulchro pulchri pulchrorum pulchris pulchros pulchri pulchris pulchra pulchrae pulchrae pulchram pulchra pulchra pulchrae pulchrarum pulchris pulchras pulchrae pulchris pulchrum pulchri pulchro pulchrum pulchrum pulchro pulchra pulchrorum pulchris pulchra pulchra pulchris pulchre} end + it "builds all forms of A/O like altus" do + args = [{type: :adjective, nominative: "altus", stem: "alt", inflection_class: 1, number_of_endings: 3, comparatio: :positivus}] + forms = LLT::FormBuilder.build(*args) + altus = forms[0] + + altus.casus.should == 1 + altus.numerus.should == 1 + altus.sexus.should == :m + altus.inflection_class.should == 1 + end + it "builds all forms of Third with 1 endings" do args = [{type: :adjective, nominative: "atrox", stem: "atroc", inflection_class: 3, number_of_endings: 1, comparatio: :positivus}] form_builder_strings(args).should == %w{atrox atrocis atroci atrocem atrox atroci atroces atrocium atrocibus atroces atroces atrocibus