Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
Dependencies_SerializationTests.cpp
Go to the documentation of this file.
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Teuchos: Common Tools Package
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
52 
54 
55 
56 namespace Teuchos{
57 
58 
59 typedef unsigned short int ushort;
60 typedef unsigned int uint;
61 typedef unsigned long int ulong;
62 typedef std::string myString_t;
63 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
64 typedef long long int llint;
65 typedef unsigned long long int ullint;
66 #endif
67 
68 #define BASIC_DEPENDENCY_TEST( \
69  DEPENDENCY, DEPTYPE, NUM_DEPENDEES, NUM_DEPENDENTS) \
70  std::string depXMLTag##DEPENDENCY = \
71  DummyObjectGetter< DEPTYPE >::getDummyObject()->getTypeAttributeValue(); \
72 \
73  TEST_ASSERT(DEPENDENCY->getTypeAttributeValue() == depXMLTag##DEPENDENCY ); \
74  TEST_ASSERT(DEPENDENCY->getDependents().size() == NUM_DEPENDENTS); \
75  TEST_ASSERT(DEPENDENCY->getDependees().size() == NUM_DEPENDEES); \
76 
77 #define VERIFY_DEPENDENT(DEPENDENCY, DEPENDENT) \
78  TEST_ASSERT( \
79  DEPENDENCY->getDependents().find(DEPENDENT) \
80  != \
81  DEPENDENCY->getDependents().end() \
82  ); \
83 
84 #define VERIFY_DEPENDEE(DEPENDENCY, DEPENDEE) \
85  TEST_ASSERT( \
86  DEPENDENCY->getDependees().find(DEPENDEE) \
87  != \
88  DEPENDENCY->getDependees().end()); \
89 
90 #define CREATE_DEPENDEE(POSTFIX, VALUE) \
91  RCP<ParameterEntry> dependeeParam##POSTFIX = rcp( \
92  new ParameterEntry( VALUE ));
93 
94 #define CREATE_DEPENDENT(POSTFIX, VALUE) \
95  RCP<ParameterEntry> dependentParam##POSTFIX = \
96  rcp(new ParameterEntry( VALUE )); \
97 
98 #define EXCEPTION_TEST_BOILERPLATE(DEPENDEE_VAL, DEPENDENT_VAL) \
99  CREATE_DEPENDEE(1, DEPENDEE_VAL); \
100  CREATE_DEPENDEE(Extra, DEPENDEE_VAL); \
101  CREATE_DEPENDENT(1, DEPENDENT_VAL); \
102 \
103  XMLParameterListWriter::EntryIDsMap writerEntryMap; \
104  writerEntryMap[dependeeParam1] = 1; \
105  writerEntryMap[dependentParam1] = 2; \
106  writerEntryMap[dependeeParamExtra] = 3; \
107  ValidatortoIDMap writerValiMap; \
108 \
109  XMLParameterListReader::EntryIDsMap readerEntryMap; \
110  readerEntryMap[1] = dependeeParam1; \
111  readerEntryMap[2] = dependentParam1; \
112  readerEntryMap[3] = dependeeParamExtra; \
113  IDtoValidatorMap readerValiMap; \
114 
115 #define CONVERT_DEP_TO_XML(DEPENDENCY) \
116  XMLObject DEPENDENCY##XML = DependencyXMLConverterDB::convertDependency( \
117  DEPENDENCY , writerEntryMap, writerValiMap); \
118 
119 #define TOO_MANY_DEPENDEE_TEST(DEPENDENCY) \
120  XMLObject extraDependee(DependencyXMLConverter::getDependeeTagName()); \
121  extraDependee.addAttribute<ParameterEntry::ParameterEntryID>( \
122  DependencyXMLConverter::getParameterIdAttributeName(), \
123  writerEntryMap[dependeeParamExtra]); \
124  XMLObject tooManyTempXML = DEPENDENCY##XML.deepCopy(); \
125  tooManyTempXML.addChild(extraDependee); \
126  \
127  TEST_THROW( \
128  DependencyXMLConverterDB::convertXML( \
129  tooManyTempXML , readerEntryMap, readerValiMap), \
130  TooManyDependeesException); \
131 
132 #define COPY_DEPTAG_WITHOUT_CHILD(TAG, CHILDTAG, NEWTAG) \
133  XMLObject NEWTAG(TAG.getTag()); \
134  NEWTAG.addAttribute( \
135  DependencyXMLConverter::getTypeAttributeName(), \
136  TAG.getAttribute(DependencyXMLConverter::getTypeAttributeName())); \
137  for(int i =0; i< TAG.numChildren(); i++){ \
138  if(TAG.getChild(i).getTag() != CHILDTAG) \
139  { \
140  NEWTAG.addChild(TAG.getChild(i).deepCopy()); \
141  } \
142  } \
143 
144 
145 #define INSERT_VALIDATOR_TO_MAPS(VALIDATOR) \
146  writerValiMap.insert( VALIDATOR ); \
147  readerValiMap.insert( \
148  IDtoValidatorMap::IDValidatorPair( \
149  writerValiMap.find( VALIDATOR )->second, VALIDATOR )); \
150 
151 
152 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, SerializationTestMacros){
153  RCP<ParameterEntry> dependee1 = rcp(new ParameterEntry(true));
157  RCP<BoolVisualDependency> simpleDep =
158  rcp(new BoolVisualDependency(dependee1, dependent1));
159 
160 
162  dependentList.insert(dependent1);
163  dependentList.insert(dependent2);
164 
165  RCP<BoolVisualDependency> complexDep =
167 
169  VERIFY_DEPENDEE(simpleDep, dependee1);
170  VERIFY_DEPENDENT(simpleDep, dependent1);
171 
172  BASIC_DEPENDENCY_TEST(complexDep, BoolVisualDependency, 1, 2);
173  VERIFY_DEPENDEE(complexDep, dependee2);
174  VERIFY_DEPENDENT(complexDep, dependent1);
175  VERIFY_DEPENDENT(complexDep, dependent2);
176 
177 }
178 
179 
180 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, StringVisualDepSerialization){
181  std::string dependee1 = "string param";
182  std::string dependee2 = "string param2";
183  std::string dependent1 = "dependent param1";
184  std::string dependent2 = "dependent param2";
185  ParameterList myDepList("String Visual Dep List");
187  myDepList.set(dependee1, "val1");
188  myDepList.set(dependee2, "val2");
189  myDepList.set(dependent1, 1.0);
190  myDepList.set(dependent2, 1.0);
191 
192  StringVisualDependency::ValueList valList1 = tuple<std::string>("val1");
193 
194  RCP<StringVisualDependency> basicStringVisDep = rcp(
196  myDepList.getEntryRCP(dependee1),
198  valList1));
199 
204  tuple<std::string>("val1", "val2");
205 
206  RCP<StringVisualDependency> complexStringVisDep = rcp(
210  valList2,
211  false));
212 
213  myDepSheet->addDependency(basicStringVisDep);
214  myDepSheet->addDependency(complexStringVisDep);
215 
217 
220  out << xmlOut.toString();
221 
224 
225  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
229 
231  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
232 
234  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
235 
239 
244 
246  rcp_dynamic_cast<StringVisualDependency>(readinDep1, true);
248  rcp_dynamic_cast<StringVisualDependency>(readinDep2, true);
249 
251  castedDep1->getValues(), basicStringVisDep->getValues());
253  castedDep2->getValues(), complexStringVisDep->getValues());
254 
255  TEST_EQUALITY(castedDep1->getShowIf(), basicStringVisDep->getShowIf());
256  TEST_EQUALITY(castedDep2->getShowIf(), complexStringVisDep->getShowIf());
257 }
258 
259 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, BoolVisualDepSerialization){
260  std::string dependee1 = "bool param";
261  std::string dependee2 = "bool param2";
262  std::string dependent1 = "dependent param1";
263  std::string dependent2 = "dependent param2";
264  ParameterList myDepList("Bool Visual Dep List");
266  myDepList.set(dependee1, true);
267  myDepList.set(dependee2, true);
268  myDepList.set(dependent1, 1.0);
269  myDepList.set(dependent2, 1.0);
270 
271  RCP<BoolVisualDependency> trueBoolVisDep = rcp(
273  myDepList.getEntryRCP(dependee1),
275 
279 
280  RCP<BoolVisualDependency> falseBoolVisDep = rcp(
284  false));
285 
286  myDepSheet->addDependency(trueBoolVisDep);
287  myDepSheet->addDependency(falseBoolVisDep);
288 
290 
293  out << xmlOut.toString();
294 
297 
298  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
302 
304  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
305 
307  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
308 
312 
317 
318 
320  rcp_dynamic_cast<BoolVisualDependency>(readinDep1, true);
322  rcp_dynamic_cast<BoolVisualDependency>(readinDep2, true);
323 
324  TEST_EQUALITY(castedDep1->getShowIf(), trueBoolVisDep->getShowIf());
325  TEST_EQUALITY(castedDep2->getShowIf(), falseBoolVisDep->getShowIf());
326 }
327 
329  Teuchos_Dependencies,
330  NumberVisualDepSerialization,
331  T)
332 {
333  std::string dependee1 = "num param";
334  std::string dependee2 = "num param2";
335  std::string dependent1 = "dependent param1";
336  std::string dependent2 = "dependent param2";
337  ParameterList myDepList("Number Visual Dep List");
339  myDepList.set(dependee1, ScalarTraits<T>::one());
341  myDepList.set(dependent1, true);
342  myDepList.set(dependent2, "vale");
343 
344  RCP<NumberVisualDependency<T> > simpleNumVisDep = rcp(
346  myDepList.getEntryRCP(dependee1),
348 
352 
353  T ten = ScalarTraits<T>::one() *10;
354  RCP<SubtractionFunction<T> > subFunction = rcp(new SubtractionFunction<T>(ten));
355  RCP<NumberVisualDependency<T> > complexNumVisDep = rcp(
359  true,
360  subFunction));
361 
362  myDepSheet->addDependency(simpleNumVisDep);
363  myDepSheet->addDependency(complexNumVisDep);
364 
366 
369  out << xmlOut.toString();
370 
373 
374  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
378 
380  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
381 
383  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
384 
388 
393 
394 
396  rcp_dynamic_cast<NumberVisualDependency<T> >(readinDep1, true);
398  rcp_dynamic_cast<NumberVisualDependency<T> >(readinDep2, true);
399 
400  TEST_EQUALITY(castedDep1->getShowIf(), simpleNumVisDep->getShowIf());
401  TEST_EQUALITY(castedDep2->getShowIf(), complexNumVisDep->getShowIf());
402 
403  RCP<const SimpleFunctionObject<T> > functionObject =
404  castedDep2->getFunctionObject();
405  TEST_ASSERT(functionObject != null);
406  RCP<const SubtractionFunction<T> > castedFunction =
407  rcp_dynamic_cast<const SubtractionFunction<T> >(functionObject);
408  TEST_ASSERT(castedFunction != null);
410  castedFunction->getModifiyingOperand(),
411  subFunction->getModifiyingOperand());
412 }
413 
414 #define NUMBER_VIS_TEST(T) \
415 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \
416  Teuchos_Dependencies, NumberVisualDepSerialization, T)
417 
418 NUMBER_VIS_TEST(int)
419 NUMBER_VIS_TEST(double)
420 NUMBER_VIS_TEST(float)
421 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
422 NUMBER_VIS_TEST(llint)
423 #endif
424 
425 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, ConditionVisualDepSerialization){
426  std::string dependee1 = "string param";
427  std::string dependee2 = "bool param";
428  std::string dependee3 = "int param";
429  std::string dependent1 = "dependent param1";
430  std::string dependent2 = "dependent param2";
431  std::string dependent3 = "dependent param3";
432  ParameterList myDepList("Condition Visual Dep List");
434  myDepList.set(dependee1, "val1");
435  myDepList.set(dependee2, true);
436  myDepList.set(dependee3, 1);
437  myDepList.set(dependent1, 1.0);
438  myDepList.set(dependent2, 1.0);
439  myDepList.set(dependent3, (float)1.0);
440 
441  StringCondition::ValueList conditionVal1 =
442  tuple<std::string>("steve", "blah", "your face");
443  RCP<StringCondition> stringCon =
444  rcp(new StringCondition(
445  myDepList.getEntryRCP(dependee1), conditionVal1));
446 
447  RCP<BoolCondition> boolCon =
449 
450  RCP<NumberCondition<int> > numberCon =
452 
454  tuple<RCP<const Condition> >(boolCon, numberCon);
455 
456  RCP<AndCondition> andCon = rcp(new AndCondition(conList));
457 
458  RCP<ConditionVisualDependency> simpleConVisDep = rcp(
460  stringCon,
462 
465  dependentList.insert(myDepList.getEntryRCP(dependent3));
466 
467  RCP<ConditionVisualDependency> complexConVisDep = rcp(
469  andCon,
471  false));
472 
473  myDepSheet->addDependency(simpleConVisDep);
474  myDepSheet->addDependency(complexConVisDep);
475 
477 
480  out << xmlOut.toString();
481 
484 
485  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
489  RCP<ParameterEntry> readinDependee3 = readInList->getEntryRCP(dependee3);
490  RCP<ParameterEntry> readinDependent3 = readInList->getEntryRCP(dependent3);
491 
493  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
494 
496  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
497 
498  RCP<Dependency> readinDep3 =
499  *(readInDepSheet->getDependenciesForParameter(readinDependee3)->begin());
500 
504 
505  TEST_ASSERT(readinDep2.get() == readinDep3.get());
506 
509  VERIFY_DEPENDEE(readinDep2, readinDependee3);
511  VERIFY_DEPENDENT(readinDep2, readinDependent3);
512 
514  rcp_dynamic_cast<ConditionVisualDependency>(readinDep1, true);
516  rcp_dynamic_cast<ConditionVisualDependency>(readinDep2, true);
517 
518  TEST_EQUALITY(castedDep1->getShowIf(), simpleConVisDep->getShowIf());
519  TEST_EQUALITY(castedDep2->getShowIf(), complexConVisDep->getShowIf());
520 
521  TEST_EQUALITY(castedDep1->getCondition()->getTypeAttributeValue(),
522  simpleConVisDep->getCondition()->getTypeAttributeValue());
523  TEST_EQUALITY(castedDep2->getCondition()->getTypeAttributeValue(),
524  complexConVisDep->getCondition()->getTypeAttributeValue());
525 }
526 
527 #define ArrayModifierTest(DEPENDENCYTYPE, ARRAY_TYPE) \
528 TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL( \
529  Teuchos_Dependencies, \
530  DEPENDENCYTYPE##_serialization_tests, \
531  DependeeType, \
532  DependentType) \
533 { \
534  std::string dependee1 = "dependee param"; \
535  std::string dependee2 = "dependee param2"; \
536  std::string dependent1 = "dependent param1"; \
537  std::string dependent2 = "dependent param2"; \
538  ParameterList myDepList("Array modifier dep list"); \
539  RCP<DependencySheet> myDepSheet = rcp(new DependencySheet); \
540  myDepList.set(dependee1, ScalarTraits<DependeeType>::one()); \
541  myDepList.set(dependee2, ScalarTraits<DependeeType>::one()); \
542  myDepList.set(dependent1, ARRAY_TYPE<DependentType>()); \
543  myDepList.set(dependent2, ARRAY_TYPE<DependentType>()); \
544  \
545  \
546  RCP<DEPENDENCYTYPE<DependeeType, DependentType> > basicArrayDep = \
547  rcp(new DEPENDENCYTYPE<DependeeType, DependentType>( \
548  myDepList.getEntryRCP(dependee1), \
549  myDepList.getEntryRCP(dependent1))); \
550  \
551  DependeeType one = ScalarTraits< DependeeType >::one(); \
552  RCP<AdditionFunction< DependeeType > > functionTester = \
553  rcp(new AdditionFunction<DependeeType>(one)); \
554  \
555  RCP<DEPENDENCYTYPE<DependeeType, DependentType> > funcArrayDep = \
556  rcp(new DEPENDENCYTYPE<DependeeType, DependentType>( \
557  myDepList.getEntryRCP(dependee2), \
558  myDepList.getEntryRCP(dependent2), \
559  functionTester)); \
560  \
561  \
562  myDepSheet->addDependency(basicArrayDep); \
563  myDepSheet->addDependency(funcArrayDep); \
564  \
565  RCP<DependencySheet> readInDepSheet = rcp(new DependencySheet); \
566  \
567  XMLParameterListWriter plWriter; \
568  XMLObject xmlOut = plWriter.toXML(myDepList, myDepSheet); \
569  out << xmlOut.toString(); \
570  \
571  RCP<ParameterList> readInList = \
572  writeThenReadPL(myDepList, myDepSheet, readInDepSheet); \
573  \
574  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1); \
575  RCP<ParameterEntry> readinDependent1 = readInList->getEntryRCP(dependent1); \
576  RCP<ParameterEntry> readinDependee2 = readInList->getEntryRCP(dependee2); \
577  RCP<ParameterEntry> readinDependent2 = readInList->getEntryRCP(dependent2); \
578  \
579  RCP<Dependency> readinDep1 = \
580  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin()); \
581  RCP<Dependency> readinDep2 = \
582  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin()); \
583  \
584  typedef DEPENDENCYTYPE<DependeeType, DependentType> deptype; \
585  BASIC_DEPENDENCY_TEST(readinDep1, deptype, 1, 1); \
586  VERIFY_DEPENDEE(readinDep1, readinDependee1); \
587  VERIFY_DEPENDENT(readinDep1, readinDependent1); \
588  \
589  BASIC_DEPENDENCY_TEST(readinDep2, deptype, 1, 1); \
590  VERIFY_DEPENDEE(readinDep2, readinDependee2); \
591  VERIFY_DEPENDENT(readinDep2, readinDependent2); \
592  \
593  RCP<DEPENDENCYTYPE<DependeeType, DependentType> > castedDep1 = \
594  rcp_dynamic_cast<DEPENDENCYTYPE<DependeeType, DependentType> >( \
595  readinDep1); \
596  TEST_ASSERT(castedDep1 != null); \
597  \
598  RCP<DEPENDENCYTYPE<DependeeType, DependentType> > castedDep2 = \
599  rcp_dynamic_cast<DEPENDENCYTYPE<DependeeType, DependentType> >( \
600  readinDep2); \
601  TEST_ASSERT(castedDep2 != null); \
602  \
603  RCP<const SimpleFunctionObject< DependeeType > > readInFunc = \
604  castedDep2->getFunctionObject(); \
605  TEST_ASSERT(readInFunc != null); \
606  \
607  RCP<const AdditionFunction< DependeeType > > castedFunc = \
608  rcp_dynamic_cast<const AdditionFunction< DependeeType > >(readInFunc); \
609  TEST_ASSERT(castedFunc != null); \
610  TEST_EQUALITY( \
611  castedFunc->getModifiyingOperand(), \
612  functionTester->getModifiyingOperand()); \
613 }
614 
615 ArrayModifierTest(NumberArrayLengthDependency, Array)
616 
617 #define NUM_ARRAY_LENGTH_TEST(DependeeType, DependentType) \
618 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( \
619  Teuchos_Dependencies, \
620  NumberArrayLengthDependency_serialization_tests, \
621  DependeeType, \
622  DependentType)
623 
624 // Need to fix array serialization so we can test this with
625 // a dependent type of strings. Right now an array of emptyr strings does not
626 // seralize correctly
627 // KLN 09.17/2010
628 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
629 #define NUM_ARRAY_LENGTH_TEST_GROUP(DependeeType) \
630  NUM_ARRAY_LENGTH_TEST(DependeeType, int) \
631  NUM_ARRAY_LENGTH_TEST(DependeeType, float) \
632  NUM_ARRAY_LENGTH_TEST(DependeeType, double) \
633  NUM_ARRAY_LENGTH_TEST(DependeeType, llint)
634 #else
635 #define NUM_ARRAY_LENGTH_TEST_GROUP(DependeeType) \
636  NUM_ARRAY_LENGTH_TEST(DependeeType, int) \
637  NUM_ARRAY_LENGTH_TEST(DependeeType, double) \
638  NUM_ARRAY_LENGTH_TEST(DependeeType, float)
639 #endif
640 
642 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
644 #endif
645 
646 ArrayModifierTest(TwoDRowDependency, TwoDArray)
647 
648 #define TWODROW_TEST(DependeeType, DependentType) \
649 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( \
650  Teuchos_Dependencies, \
651  TwoDRowDependency_serialization_tests, \
652  DependeeType, \
653  DependentType)
654 
655 // Need to fix array serialization so we can test this with
656 // a dependent type of strings. Right now an array of emptyr strings does not
657 // seralize correctly
658 // KLN 09.17/2010
659 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
660 #define TWODROW_TEST_GROUP(DependeeType) \
661  TWODROW_TEST(DependeeType, int) \
662  TWODROW_TEST(DependeeType, float) \
663  TWODROW_TEST(DependeeType, double) \
664  TWODROW_TEST(DependeeType, llint)
665 #else
666 #define TWODROW_TEST_GROUP(DependeeType) \
667  TWODROW_TEST(DependeeType, int) \
668  TWODROW_TEST(DependeeType, double) \
669  TWODROW_TEST(DependeeType, float)
670 #endif
671 
673 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
674 TWODROW_TEST_GROUP(llint)
675 #endif
676 
677 ArrayModifierTest(TwoDColDependency, TwoDArray)
678 
679 #define TWODCOL_TEST(DependeeType, DependentType) \
680 TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT( \
681  Teuchos_Dependencies, \
682  TwoDColDependency_serialization_tests, \
683  DependeeType, \
684  DependentType)
685 
686 // Need to fix array serialization so we can test this with
687 // a dependent type of strings. Right now an array of emptyr strings does not
688 // seralize correctly
689 // KLN 09.17/2010
690 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
691 #define TWODCOL_TEST_GROUP(DependeeType) \
692  TWODCOL_TEST(DependeeType, int) \
693  TWODCOL_TEST(DependeeType, float) \
694  TWODCOL_TEST(DependeeType, double) \
695  TWODCOL_TEST(DependeeType, llint)
696 #else
697 #define TWODCOL_TEST_GROUP(DependeeType) \
698  TWODCOL_TEST(DependeeType, int) \
699  TWODCOL_TEST(DependeeType, double) \
700  TWODCOL_TEST(DependeeType, float)
701 #endif
702 
704 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
705 TWODCOL_TEST_GROUP(llint)
706 #endif
707 
709  std::string dependee1 = "string param";
710  std::string dependee2 = "string param2";
711  std::string dependent1 = "dependent param1";
712  std::string dependent2 = "dependent param2";
713  ParameterList myDepList("String Vali Dep List");
715  myDepList.set(dependee1, "val1");
716  myDepList.set(dependee2, "val2");
717  myDepList.set(dependent1, 2.0);
718  myDepList.set(dependent2, 3.0);
719 
722 
725 
728 
732 
735  myDepList.getEntryRCP(dependee1),
738 
742 
748  defaultVali));
749 
750  myDepSheet->addDependency(basicStringValiDep);
751  myDepSheet->addDependency(complexStringValiDep);
752 
754 
757  out << xmlOut.toString();
758 
761 
762  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
766 
768  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
769 
771  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
772 
776 
781 
782 
784  rcp_dynamic_cast<StringValidatorDependency>(readinDep1, true);
786  rcp_dynamic_cast<StringValidatorDependency>(readinDep2, true);
787 
788  TEST_ASSERT(castedDep1->getValuesAndValidators().size() == 2);
789  TEST_ASSERT(castedDep2->getValuesAndValidators().size() == 2);
790  TEST_ASSERT(castedDep1->getDefaultValidator().is_null());
791  TEST_ASSERT(nonnull(castedDep2->getDefaultValidator()));
792 
794  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
795  castedDep1->getValuesAndValidators().find("val1")->second, true)->getMax(),
796  double1Vali->getMax());
798  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
799  castedDep2->getValuesAndValidators().find("val1")->second, true)->getMax(),
800  double1Vali->getMax());
801 
803  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
804  castedDep1->getValuesAndValidators().find("val2")->second, true)->getMax(),
805  double2Vali->getMax());
807  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
808  castedDep2->getValuesAndValidators().find("val2")->second, true)->getMax(),
809  double2Vali->getMax());
810 
812  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
813  castedDep2->getDefaultValidator(), true)->getMax(),
814  defaultVali->getMax());
815 
816 }
817 
818 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, BoolValidatorDepSerialization){
819  std::string dependee1 = "bool param";
820  std::string dependee2 = "bool param2";
821  std::string dependent1 = "dependent param1";
822  std::string dependent2 = "dependent param2";
823  ParameterList myDepList("Bool Vali Dep List");
825  myDepList.set(dependee1, true);
826  myDepList.set(dependee2, false);
827  myDepList.set(dependent1, 2.0);
828  myDepList.set(dependent2, 3.0);
829 
832 
835 
838 
839 
840  RCP<BoolValidatorDependency> simpleBoolValiDep = rcp(
842  myDepList.getEntryRCP(dependee1),
844  true1Vali,
845  false1Vali));
846 
850 
851  RCP<BoolValidatorDependency> complexBoolValiDep = rcp(
855  true2Vali));
856 
857  myDepSheet->addDependency(simpleBoolValiDep);
858  myDepSheet->addDependency(complexBoolValiDep);
859 
861 
864  out << xmlOut.toString();
865 
868 
869  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
873 
875  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
876 
878  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
879 
883 
888 
889 
891  rcp_dynamic_cast<BoolValidatorDependency>(readinDep1, true);
893  rcp_dynamic_cast<BoolValidatorDependency>(readinDep2, true);
894 
895  TEST_ASSERT(nonnull(castedDep1->getTrueValidator()));
896  TEST_ASSERT(nonnull(castedDep1->getFalseValidator()));
897  TEST_ASSERT(nonnull(castedDep2->getTrueValidator()));
898  TEST_ASSERT(castedDep2->getFalseValidator().is_null());
900  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
901  castedDep1->getTrueValidator(), true)->getMax(),
902  true1Vali->getMax());
904  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
905  castedDep1->getFalseValidator(), true)->getMax(),
906  false1Vali->getMax());
908  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
909  castedDep2->getTrueValidator(), true)->getMax(),
910  true2Vali->getMax());
911 
912 }
913 
914 
916  Teuchos_Dependencies, RangeValidatorDepSerialization, T)
917 {
918  std::string dependee1 = "dependee param";
919  std::string dependee2 = "dependee param2";
920  std::string dependent1 = "dependent param1";
921  std::string dependent2 = "dependent param2";
922  ParameterList myDepList("Range Vali Dep List");
924  myDepList.set(dependee1, ScalarTraits<T>::one());
926  myDepList.set(dependent1, 2.0);
927  myDepList.set(dependent2, 3.0);
928 
931 
934 
935  RCP<EnhancedNumberValidator<double> > defaultValidator =
937 
938  typename RangeValidatorDependency<T>::Range range1(0,10);
939  typename RangeValidatorDependency<T>::Range range2(11,50);
940 
942  rangeValiMap[range1] = double1Vali;
943  rangeValiMap[range2] = double2Vali;
944 
945  RCP<RangeValidatorDependency<T> > simpleRangeValiDep = rcp(
947  myDepList.getEntryRCP(dependee1),
949  rangeValiMap));
950 
954 
955  RCP<RangeValidatorDependency<T> > complexRangeValiDep = rcp(
959  rangeValiMap,
960  defaultValidator));
961 
962  myDepSheet->addDependency(simpleRangeValiDep);
963  myDepSheet->addDependency(complexRangeValiDep);
964 
966 
969  out << xmlOut.toString();
970 
973 
974  RCP<ParameterEntry> readinDependee1 = readInList->getEntryRCP(dependee1);
978 
980  *(readInDepSheet->getDependenciesForParameter(readinDependee1)->begin());
981 
983  *(readInDepSheet->getDependenciesForParameter(readinDependee2)->begin());
984 
988 
993 
994 
996  rcp_dynamic_cast<RangeValidatorDependency<T> >(readinDep1, true);
998  rcp_dynamic_cast<RangeValidatorDependency<T> >(readinDep2, true);
999 
1001  castedDep1->getRangeToValidatorMap();
1002  TEST_EQUALITY(readinMap1.size(), 2);
1004  readinMap1.begin();
1005  TEST_EQUALITY(it->first.first, 0);
1006  TEST_EQUALITY(it->first.second, 10);
1007  it++;
1008  TEST_EQUALITY(it->first.first, 11);
1009  TEST_EQUALITY(it->first.second, 50);
1010 
1011 
1013  readinMap1.find(range1)->second;
1015  readinMap1.find(range2)->second;
1016  TEST_EQUALITY(
1017  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
1018  range1Vali, true)->getMax(),
1019  double1Vali->getMax());
1020  TEST_EQUALITY(
1021  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
1022  range2Vali, true)->getMax(),
1023  double2Vali->getMax());
1024 
1026  castedDep2->getRangeToValidatorMap();
1027  it = readinMap2.begin();
1028  TEST_EQUALITY(it->first.first, 0);
1029  TEST_EQUALITY(it->first.second, 10);
1030  it++;
1031  TEST_EQUALITY(it->first.first, 11);
1032  TEST_EQUALITY(it->first.second, 50);
1033 
1034  TEST_EQUALITY(
1035  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
1036  readinMap2.find(range1)->second, true)->getMax(),
1037  double1Vali->getMax());
1038  TEST_EQUALITY(
1039  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
1040  readinMap2.find(range2)->second, true)->getMax(),
1041  double2Vali->getMax());
1042 
1043  RCP<const EnhancedNumberValidator<double> > defaultReadInVali =
1044  rcp_dynamic_cast<const EnhancedNumberValidator<double> >(
1045  castedDep2->getDefaultValidator());
1046  TEST_EQUALITY( defaultReadInVali->getMax(), defaultValidator->getMax());
1047  TEST_EQUALITY( defaultReadInVali->getMin(), defaultValidator->getMin());
1048 }
1049 
1050 
1051 #define RANGE_VALIDATOR_TEST(T) \
1052 TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT( \
1053  Teuchos_Dependencies, RangeValidatorDepSerialization, T)
1054 
1056 RANGE_VALIDATOR_TEST(double)
1057 RANGE_VALIDATOR_TEST(float)
1058 #ifdef HAVE_TEUCHOS_LONG_LONG_INT
1059 RANGE_VALIDATOR_TEST(llint)
1060 #endif
1061 
1062 /* General Testing*/
1063 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, DependencySerializationExceptions){
1064 
1065  RCP<DependencySheet> depSheet = rcp(new DependencySheet);
1066 
1067  TEST_THROW(RCP<ParameterList> missingDependeeList =
1068  getParametersFromXmlFile("MissingDependeeTag.xml", depSheet),
1070  TEST_THROW(RCP<ParameterList> missingDependentsList =
1071  getParametersFromXmlFile("MissingDependentTag.xml", depSheet),
1073  TEST_THROW(RCP<ParameterList> missingDependeeList =
1074  getParametersFromXmlFile("MissingDependee.xml", depSheet),
1076  TEST_THROW(RCP<ParameterList> missingDependentList =
1077  getParametersFromXmlFile("MissingDependent.xml", depSheet),
1079 
1080  RCP<ParameterEntry> dependeeParam = rcp(new ParameterEntry(true));
1081  RCP<ParameterEntry> dependentParam = rcp(new ParameterEntry("blah"));
1082  RCP<BoolVisualDependency> boolVisDep =
1083  rcp(new BoolVisualDependency(dependeeParam, dependentParam));
1084 
1086  entryIDsMap[dependentParam] = 1;
1087  ValidatortoIDMap validatorIDsMap;
1088  BoolVisualDependencyXMLConverter boolVisConverter;
1089  TEST_THROW(
1090  boolVisConverter.fromDependencytoXML(
1091  boolVisDep, entryIDsMap, validatorIDsMap),
1093  entryIDsMap.erase(dependentParam);
1094  entryIDsMap[dependeeParam] = 3;
1095  TEST_THROW(
1096  boolVisConverter.fromDependencytoXML(
1097  boolVisDep, entryIDsMap, validatorIDsMap),
1099 }
1100 
1101 /* Testing serialization exceptions for NumberVisualDependencies */
1102 
1103 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, NumberVisualDepSerializationExceptions){
1104 
1105  EXCEPTION_TEST_BOILERPLATE(4, "blah");
1106  RCP<Dependency> numVisDep =
1107  rcp(new NumberVisualDependency<int>(dependeeParam1, dependentParam1));
1108  CONVERT_DEP_TO_XML(numVisDep);
1109  TOO_MANY_DEPENDEE_TEST(numVisDep);
1110 
1111 }
1112 
1113 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, BoolVisualDepSerializationExceptions){
1114  EXCEPTION_TEST_BOILERPLATE(true, "blah");
1115  RCP<Dependency> boolVisDep =
1116  rcp(new BoolVisualDependency(dependeeParam1, dependentParam1));
1117  CONVERT_DEP_TO_XML(boolVisDep);
1118  TOO_MANY_DEPENDEE_TEST(boolVisDep);
1119 }
1120 
1121 TEUCHOS_UNIT_TEST(Teuchos_Dependencies, StringVisualDepSerializationExceptions)
1122 {
1123  EXCEPTION_TEST_BOILERPLATE(std::string("balh"), 4);
1124  RCP<Dependency> stringVisDep =
1125  rcp(new StringVisualDependency(dependeeParam1, dependentParam1, "steve"));
1126  CONVERT_DEP_TO_XML(stringVisDep);
1127  TOO_MANY_DEPENDEE_TEST(stringVisDep);
1128 
1130  stringVisDepXML,
1132  missingValuesXML);
1133 
1134  TEST_THROW(
1136  missingValuesXML, readerEntryMap, readerValiMap),
1138 
1139 }
1140 
1142  Teuchos_Dependencies, ConditionVisualDepSerializationExceptions)
1143 {
1144  EXCEPTION_TEST_BOILERPLATE(true, 4);
1145  RCP<Condition> boolCon = rcp(new BoolCondition(dependeeParam1));
1146  RCP<Dependency> conVisDep =
1147  rcp(new ConditionVisualDependency(boolCon, dependentParam1));
1148  CONVERT_DEP_TO_XML(conVisDep);
1150  conVisDepXML,
1152  missingConXML);
1153 
1154  TEST_THROW(
1156  missingConXML, readerEntryMap, readerValiMap),
1158 }
1159 
1161  Teuchos_Dependencies, BoolValidatorDepSerializationExceptions)
1162 {
1163  EXCEPTION_TEST_BOILERPLATE(true, 7);
1166  RCP<EnhancedNumberValidator<int> > falseVali =
1168  INSERT_VALIDATOR_TO_MAPS(trueVali);
1169  INSERT_VALIDATOR_TO_MAPS(falseVali);
1170  RCP<Dependency> boolValiDep =
1172  dependeeParam1,
1173  dependentParam1,
1174  trueVali,
1175  falseVali));
1176  CONVERT_DEP_TO_XML(boolValiDep);
1177  TOO_MANY_DEPENDEE_TEST(boolValiDep);
1178 
1179  readerValiMap.erase(writerValiMap.find(trueVali)->second);
1180 
1181  TEST_THROW(
1183  boolValiDepXML, readerEntryMap, readerValiMap),
1185 
1186  readerValiMap.insert( IDtoValidatorMap::IDValidatorPair(
1187  writerValiMap.find(trueVali)->second, trueVali));
1188  readerValiMap.erase(writerValiMap.find(falseVali)->second);
1189 
1190  TEST_THROW(
1192  boolValiDepXML, readerEntryMap, readerValiMap),
1194 
1195 }
1196 
1198  Teuchos_Dependencies, StringValidatorDepSerializationExceptions)
1199 {
1200  EXCEPTION_TEST_BOILERPLATE(std::string("blah"), 4);
1201  RCP<FileNameValidator> scrapVali =
1203  RCP<FileNameValidator> scrapVali2 =
1206  valiMap["blah"] = scrapVali;
1207  INSERT_VALIDATOR_TO_MAPS(scrapVali);
1208  INSERT_VALIDATOR_TO_MAPS(scrapVali2);
1209 
1210  RCP<Dependency> stringValiDep =
1212  dependeeParam1, dependentParam1, valiMap, scrapVali2));
1213  CONVERT_DEP_TO_XML(stringValiDep);
1214 
1215  TOO_MANY_DEPENDEE_TEST(stringValiDep);
1216 
1218  stringValiDepXML,
1220  missingValuesXML);
1221 
1222  TEST_THROW(
1224  missingValuesXML, readerEntryMap, readerValiMap),
1226 
1227  readerValiMap.erase(writerValiMap.find(scrapVali)->second);
1228 
1229  TEST_THROW(
1231  stringValiDepXML, readerEntryMap, readerValiMap),
1233 
1234  readerValiMap.insert( IDtoValidatorMap::IDValidatorPair(
1235  writerValiMap.find(scrapVali)->second,scrapVali));
1236  readerValiMap.erase(writerValiMap.find(scrapVali2)->second);
1237 
1238  TEST_THROW(
1240  stringValiDepXML, readerEntryMap, readerValiMap),
1242 }
1243 
1245  Teuchos_Dependencies, RangeValidatorDepSerializationExceptions)
1246 {
1247  EXCEPTION_TEST_BOILERPLATE(3, "blah");
1248 
1249  RCP<FileNameValidator> scrapVali =
1251  RCP<FileNameValidator> otherScrapVali =
1253  RCP<FileNameValidator> defaultScrapVali =
1257  RangeValidatorDependency<int>::Range scrapRange(2,5);
1258  valiMap[scrapRange] = scrapVali;
1259  secondvaliMap[scrapRange] = otherScrapVali;
1260  writerValiMap.insert(scrapVali);
1261  writerValiMap.insert(otherScrapVali);
1262  writerValiMap.insert(defaultScrapVali);
1263  readerValiMap.insert(
1265  writerValiMap.find(scrapVali)->second,scrapVali));
1266  readerValiMap.insert(
1268  writerValiMap.find(otherScrapVali)->second,otherScrapVali));
1269  readerValiMap.insert(
1271  writerValiMap.find(defaultScrapVali)->second,defaultScrapVali));
1272 
1273  RCP<Dependency> rangeDep =
1275  dependeeParam1, dependentParam1, valiMap));
1276 
1277  RCP<Dependency> rangeDefaultDep =
1279  dependeeParam1, dependentParam1, secondvaliMap, defaultScrapVali));
1280 
1281  CONVERT_DEP_TO_XML(rangeDep);
1282  CONVERT_DEP_TO_XML(rangeDefaultDep);
1283 
1284  TOO_MANY_DEPENDEE_TEST(rangeDep);
1285 
1287  rangeDepXML,
1289  missingRangesXML
1290  )
1291 
1292  TEST_THROW(
1294  missingRangesXML, readerEntryMap, readerValiMap),
1296 
1297  readerValiMap.erase(writerValiMap.find(scrapVali)->second);
1298 
1299  TEST_THROW(
1301  rangeDepXML, readerEntryMap, readerValiMap),
1303 
1304  readerValiMap.erase(writerValiMap.find(defaultScrapVali)->second);
1305  TEST_THROW(
1307  rangeDefaultDepXML, readerEntryMap, readerValiMap),
1309 
1310 }
1311 
1313  Teuchos_Dependencies, NumArrayLengthDepSerializationExceptions)
1314 {
1316  RCP<Dependency> numArrayLengthDep =
1318  dependeeParam1, dependentParam1));
1319  CONVERT_DEP_TO_XML(numArrayLengthDep);
1320  TOO_MANY_DEPENDEE_TEST(numArrayLengthDep);
1321 }
1322 
1325  Teuchos_Dependencies, DepSheetTests)
1326 {
1327  ParameterList myDepList("String Visual Dep List");
1328  std::string dependee1 = "dependee1";
1329  std::string dependent1 = "dependent1";
1331  myDepList.set(dependee1, "val1");
1332  myDepList.set(dependent1, 2.0);
1333  StringVisualDependency::ValueList valList1 = tuple<std::string>("val1");
1334  RCP<StringVisualDependency> basicStringVisDep = rcp(
1336  myDepList.getEntryRCP(dependee1),
1338  valList1));
1339  myDepSheet->addDependency(basicStringVisDep);
1340 
1342 
1345  out << xmlOut.toString();
1346 
1349  TEST_EQUALITY(readInDepSheet->getName(), myDepSheet->getName());
1350 }
1351 
1352 
1353 } //namespace Teuchos
1354 
#define COPY_DEPTAG_WITHOUT_CHILD(TAG, CHILDTAG, NEWTAG)
RCP< EnhancedNumberValidator< double > > defaultVali
A Dependency sheet keeps track of dependencies between various ParameterEntries.
Thrown when no dependes of a dependency can&#39;t be found when converting the dependency to or from XML...
XMLObject fromDependencytoXML(const RCP< const Dependency > dependency, const XMLParameterListWriter::EntryIDsMap &entryIDsMap, ValidatortoIDMap &validatorIDsMap) const
Converters a given ParameterEntryValidator to XML.
Dependency::ParameterEntryList dependentList
static RCP< T > getDummyObject()
Retrieves a dummy object of type T.
A BoolValidatorDependency says the following about the relationship between two parameters: Dependeni...
RCP< EnhancedNumberValidator< double > > double1Vali
#define INSERT_VALIDATOR_TO_MAPS(VALIDATOR)
Thrown when a StringVisualDependency is being converted from XML and no Values tag is found...
RCP< ParameterEntry > getEntryRCP(const std::string &name)
Retrieves the RCP for an entry with the name name if it exists.
BASIC_DEPENDENCY_TEST(readinDep1, StringValidatorDependency, 1, 1)
A database for DependencyXMLConverters.
A string visual depdencies says the following about the relationship between two elements in a Parame...
A bool visual dependency says the following about the relationship between two elements in a Paramete...
#define EXCEPTION_TEST_BOILERPLATE(DEPENDEE_VAL, DEPENDENT_VAL)
std::set< RCP< ParameterEntry >, RCPComp > ParameterEntryList
A list of Dependees.
ParameterList & set(std::string const &name, T const &value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
Set a parameter whose value has type T.
bool nonnull(const std::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
This object is held as the "value" in the Teuchos::ParameterList std::map.
StringValidatorDependency::ValueToValidatorMap valuesAndValidators
A Bool Logic Condition that returns the result or perfroming a logical AND on the conditions...
static const std::string & getXMLTagName()
#define RANGE_VALIDATOR_TEST(T)
#define TEST_THROW(code, ExceptType)
Assert that the statement &#39;code&#39; throws the exception &#39;ExceptType&#39; (otherwise the test fails)...
Thrown when a dependent of a dependency cant be found when converting the dependency to or from XML...
RCP< DependencySheet > myDepSheet
std::map< std::string, RCP< const ParameterEntryValidator > > ValueToValidatorMap
Conveniece typedef.
A Number Condition is a Parameter Condition that evaluates whether or not a number parameter is great...
#define NUMBER_VIS_TEST(T)
Simple helper functions that make it easy to read and write XML to and from a parameterlist.
T * get() const
Get the raw C++ pointer to the underlying object.
RCP< EnhancedNumberValidator< double > > double2Vali
This structure defines some basic traits for a scalar field type.
A RangeValidatorDependency says the following about the relationship between two parameters: Dependen...
RCP< Dependency > readinDep2
RCP< Dependency > readinDep1
RCP< DependencySheet > readInDepSheet
A simple function object that subtracts a specififed value from the given arguement in the runFunctio...
TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(RCPNodeHandle, basicConstruct_owns_mem, T)
static const std::string & getStringValuesTagName()
Gets the StringValues Tag.
TEUCHOS_UNIT_TEST(ConstNonconstObjectContainer, create)
ArrayModifierTest(NumberArrayLengthDependency, Array) ArrayModifierTest(TwoDRowDependency
XMLObject toXML(const ParameterList &p, RCP< const DependencySheet > depSheet=null) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Deprecated.
Templated Parameter List class.
Thrown when no dependents of a dependency are specified when converting the dependency from XML...
Representation of an XML data tree. XMLObject is a ref-counted handle to a XMLObjectImplem object...
XMLParameterListWriter plWriter
A collection of standard DependencyXMLConverters.
A String Condition is a Parameter Condition that evaluates whether or not a string parameter has take...
#define TWODROW_TEST_GROUP(DependeeType)
RCP< StringValidatorDependency > castedDep1
std::map< RCP< const ParameterEntry >, ParameterEntry::ParameterEntryID, RCPConstComp > EntryIDsMap
Unit testing support.
#define NUM_ARRAY_LENGTH_TEST_GROUP(DependeeType)
Thrown when the rangesAndValidators tag for the RangeValidatorDepencyConverter can&#39;t be found...
A NumberArrayLengthDependency says the following about the relationship between two parameters: The l...
A class for mapping validators to integers.
RCP< StringValidatorDependency > castedDep2
#define TWODCOL_TEST_GROUP(DependeeType)
A list of parameters of arbitrary type.
A collection of standard dependencies.
std::string toString() const
Represent this node and its children as a std::string.
RCP< ParameterEntry > readinDependent2
RCP< ParameterEntry > readinDependent1
A Bool Condition is a Parameter Condition that evaluates whether or not a Boolean parameter is ture...
bool getShowIf() const
Get&#39;s the value of the showIf variable.
#define TEST_COMPARE_ARRAYS(a1, a2)
Assert that a1.size()==a2.size() and a[i]==b[i], i=0....
DataStructure keeping track of dependencies.
RCP< ParameterEntry > readinDependee2
A StringValidatorDependency says the following about the relationship between two parameters: Depende...
std::pair< ParameterEntryValidator::ValidatorID, RCP< ParameterEntryValidator > > IDValidatorPair
Class uesd to validate a particular type of number.
Thrown when converting a StrinvValidatorDependcny from XML and no valuesAndValidators tag is found...
TEST_ASSERT(castedDep1->getValuesAndValidators().size()==2)
VERIFY_DEPENDENT(readinDep1, readinDependent1)
RCP< StringValidatorDependency > basicStringValiDep
Smart reference counting pointer class for automatic garbage collection.
A condition visual dependency says the following about the relationship between elements in a Paramet...
TEST_EQUALITY(rcp_dynamic_cast< const EnhancedNumberValidator< double > >(castedDep1->getValuesAndValidators().find("val1") ->second, true) ->getMax(), double1Vali->getMax())
#define CONVERT_DEP_TO_XML(DEPENDENCY)
out<< xmlOut.toString();RCP< ParameterList > readInList
Thrown when converting a dependency that has validaotrs to and from XML. This excetpion indicates tha...
RCP< ParameterEntry > readinDependee1
std::pair< T, T > Range
Convenience typedef.
static RCP< Dependency > convertXML(const XMLObject &xmlObject, const XMLParameterListReader::EntryIDsMap &entryIDsMap, const IDtoValidatorMap &validatorIDsMap)
Given an XMLObject converts the XMLObject to a Dependency.
TEUCHOSPARAMETERLIST_LIB_DLL_EXPORT RCP< ParameterList > writeThenReadPL(ParameterList &myList)
Write a parameter list to xml and then read that xml back in via a string. The intent of this functio...
Thrown when no condtion tag is found when converting a ConditionVisualDependency from XML...
A number visual dependency says the following about the relationship between two elements in a Parame...
VERIFY_DEPENDEE(readinDep1, readinDependee1)
RCP< StringValidatorDependency > complexStringValiDep
static T one()
Returns representation of one for this scalar type.
std::map< Range, RCP< const ParameterEntryValidator > > RangeToValidatorMap
Convenience typedef.
Standard Conditions to be used.
#define TOO_MANY_DEPENDEE_TEST(DEPENDENCY)
Thrown when no dependess of a dependency are specified when converting the dependency from XML...
RCP< const Condition > getCondition() const
Gets the condition being used in this dependency.
Writes a ParameterList to an XML object.
ParameterList myDepList("String Vali Dep List")