From 0bfe38bef5df856f8270312c89b2b4a9fb1f03da Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Mal=C3=BD?= Date: Fri, 19 Dec 2014 02:05:54 +0100 Subject: [PATCH] Check that all elements in the assignment array are present in acidobazic suite --- src/face_generators/face_generator.adb | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/face_generators/face_generator.adb b/src/face_generators/face_generator.adb index ae8a184..f27a4a7 100644 --- a/src/face_generators/face_generator.adb +++ b/src/face_generators/face_generator.adb @@ -131,13 +131,41 @@ package body Face_Generator is Insert(Translations, Assoc(RESERVED_PROBLEM_ID_VAL_KEY, Pr_ID)); Insert(Translations, Assoc(RESERVED_PROBLEM_CATEGORY_KEY, RESERVED_PROBLEM_CATEGORY_KEY)); Insert(Translations, Assoc(RESERVED_PROBLEM_CATEGORY_VAL_KEY, Pr_Cat)); + if Assignment.Find(Acidobazic_Suite.CONCENTRATION_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.CONCENTRATION_INT_KEY, Assignment.Element(Acidobazic_Suite.CONCENTRATION_INT_KEY))); + + if Assignment.Find(Acidobazic_Suite.CONCENTRATION_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.CONCENTRATION_DEC_KEY, Assignment.Element(Acidobazic_Suite.CONCENTRATION_DEC_KEY))); + + if Assignment.Find(Acidobazic_Suite.CONCENTRATION_EXP_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.CONCENTRATION_EXP_KEY, Assignment.Element(Acidobazic_Suite.CONCENTRATION_EXP_KEY))); + + if Assignment.Find(Acidobazic_Suite.PKX_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.PKX_KEY, Assignment.Element(Acidobazic_Suite.PKX_KEY))); + + if Assignment.Find(Acidobazic_Suite.PKX_VALUE_INT_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.PKX_VALUE_INT_KEY, Assignment.Element(Acidobazic_Suite.PKX_VALUE_INT_KEY))); + + if Assignment.Find(Acidobazic_Suite.PKX_VALUE_DEC_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.PKX_VALUE_DEC_KEY, Assignment.Element(Acidobazic_Suite.PKX_VALUE_DEC_KEY))); + + if Assignment.Find(Acidobazic_Suite.SUBSTANCE_KEY) = Assignment_Info.No_Element then + return E_INVAL; + end if; Insert(Translations, Assoc(Acidobazic_Suite.SUBSTANCE_KEY, Assignment.Element(Acidobazic_Suite.SUBSTANCE_KEY))); + Insert(Translations, Assoc("ANSWER_PH", Acidobazic_Suite.ANSWER_PH_KEY)); Insert(Translations, Assoc("ANSWER_SIMPLIFICATION", Acidobazic_Suite.ANSWER_SIMPLIFICATION_KEY)); Insert(Translations, Assoc("ANSWER_OPTION_SIMPL_ATPR", Acidobazic_Suite.Simplification'Image(Acidobazic_Suite.Autoprotolysis))); -- 2.43.5