@@ -155,6 +155,73 @@ TEST_CASE("InflectableStringConceptTest-c#testExistsAPISpanish")
155155 iinf_destroy (inflectableConcept);
156156}
157157
158+ TEST_CASE (" InflectableStringConceptTest-c#testCreateWithDefaults" )
159+ {
160+ auto error = U_ZERO_ERROR;
161+ auto ccfp = ilccfp_getDefaultCommonConceptFactoryProvider (&error);
162+ REQUIRE (U_SUCCESS (error));
163+
164+ const auto locale = ::inflection::util::LocaleUtils::SPANISH ().getName ().c_str ();
165+ auto ccf = ilccfp_getCommonConceptFactory (ccfp, locale, &error);
166+ REQUIRE (U_SUCCESS (error));
167+
168+ auto model = iccf_getSemanticFeatureModel (ccf, &error);
169+ REQUIRE (U_SUCCESS (error));
170+
171+ const std::u16string source = u" cometa" ;
172+ auto sourceString = iss_create (source.c_str (), static_cast <int32_t >(source.size ()), &error);
173+ REQUIRE (U_SUCCESS (error));
174+
175+ IDDisplayValue_Constraint defaultConstraints[] = {
176+ {u" gender" , u" masculine" },
177+ };
178+
179+ auto inflectableConcept = iinf_createWithDefaults (model,
180+ sourceString,
181+ defaultConstraints,
182+ static_cast <int32_t >(sizeof (defaultConstraints) / sizeof (defaultConstraints[0 ])),
183+ &error);
184+ iss_destroy (sourceString);
185+ REQUIRE (U_SUCCESS (error));
186+ REQUIRE (inflectableConcept != nullptr );
187+
188+ auto semanticConcept = iinf_toSemanticFeatureConcept (inflectableConcept, &error);
189+ REQUIRE (U_SUCCESS (error));
190+
191+ isfc_putConstraintByName (semanticConcept, u" definiteness" , u" definite" , -1 , &error);
192+ REQUIRE (U_SUCCESS (error));
193+
194+ auto printedValue = isfc_toSpeakableStringCopy (semanticConcept, &error);
195+ REQUIRE (U_SUCCESS (error));
196+ util::StringContainer<IDSpeakableString, iss_getPrint> printedContainer (printedValue);
197+ REQUIRE (printedContainer);
198+ CHECK (printedContainer.value == u" el cometa" );
199+ iss_destroy (printedValue);
200+
201+ auto genderValue = isfc_createFeatureValueByNameCopy (semanticConcept, u" gender" , &error);
202+ REQUIRE (U_SUCCESS (error));
203+ util::StringContainer<IDSpeakableString, iss_getPrint> genderContainer (genderValue);
204+ REQUIRE (genderContainer);
205+ CHECK (genderContainer.value == u" masculine" );
206+ iss_destroy (genderValue);
207+
208+ auto numberValue = isfc_createFeatureValueByNameCopy (semanticConcept, u" number" , &error);
209+ REQUIRE (U_SUCCESS (error));
210+ util::StringContainer<IDSpeakableString, iss_getPrint> numberContainer (numberValue);
211+ REQUIRE (numberContainer);
212+ CHECK (numberContainer.value == u" singular" );
213+ iss_destroy (numberValue);
214+
215+ auto definitenessValue = isfc_createFeatureValueByNameCopy (semanticConcept, u" definiteness" , &error);
216+ REQUIRE (U_SUCCESS (error));
217+ util::StringContainer<IDSpeakableString, iss_getPrint> definitenessContainer (definitenessValue);
218+ REQUIRE (definitenessContainer);
219+ CHECK (definitenessContainer.value == u" definite" );
220+ iss_destroy (definitenessValue);
221+
222+ iinf_destroy (inflectableConcept);
223+ }
224+
158225TEST_CASE (" InflectableStringConceptTest-c#testSpanish" )
159226{
160227 auto error = U_ZERO_ERROR;
0 commit comments