MeshKit  1.0
ruleAppObj2D.cpp
Go to the documentation of this file.
00001 
00014 // C++
00015 #include <iostream>
00016 #include <list>
00017 
00018 // MeshKit
00019 #include "meshkit/AF2Point2D.hpp"
00020 #include "meshkit/AF2Polygon2D.hpp"
00021 #include "meshkit/AF2RuleApplication.hpp"
00022 #include "meshkit/Error.hpp"
00023 
00024 // MeshKit test utilities
00025 #include "TestUtil.hpp"
00026 
00027 void makeTriangle(AF2Point2D const & v0, AF2Point2D const & v1,
00028     AF2Point2D const & v2, AF2Polygon2D* & trianglePtr);
00029 AF2Polygon2D* makeQuad(AF2Point2D const & v0, AF2Point2D const & v1,
00030     AF2Point2D const & v2, AF2Point2D const & v3);
00031 AF2RuleApplication* makeZeroNewPointsRuleApplication(AF2Point2D const & v0,
00032     AF2Point2D const & v1, AF2Point2D const & v2);
00033 AF2RuleApplication* makeTwoNewPointsRuleApplication(AF2Point2D const & v0,
00034     AF2Point2D const & v1, double v2x, double v2y, double v3x, double v3y);
00035 void testPolygonCreateDestroy();
00036 void testPolygonCopy();
00037 void testPolygonAssign();
00038 void testPolygonConstructorException();
00039 void testPolygonRangeException();
00040 void testRuleAppZeroPntsCreateDestroy();
00041 void testRuleAppZeroPntsCopy();
00042 void testRuleAppZeroPntsAssign();
00043 void testRuleAppTwoPntsCreateDestroy();
00044 void testRuleAppTwoPntsCopy();
00045 void testRuleAppTwoPntsAssign();
00046 void testRuleAppConstructorExceptions();
00047 void testRuleAppRangeExceptions();
00048 
00049 int main(int argc, char **argv)
00050 {
00051 
00052   int num_fail = 0;
00053 
00054   num_fail += RUN_TEST(testPolygonCreateDestroy);
00055   num_fail += RUN_TEST(testPolygonCopy);
00056   num_fail += RUN_TEST(testPolygonAssign);
00057   num_fail += RUN_TEST(testPolygonConstructorException);
00058   num_fail += RUN_TEST(testPolygonRangeException);
00059   num_fail += RUN_TEST(testRuleAppZeroPntsCreateDestroy);
00060   num_fail += RUN_TEST(testRuleAppZeroPntsCopy);
00061   num_fail += RUN_TEST(testRuleAppZeroPntsAssign);
00062   num_fail += RUN_TEST(testRuleAppTwoPntsCreateDestroy);
00063   num_fail += RUN_TEST(testRuleAppTwoPntsCopy);
00064   num_fail += RUN_TEST(testRuleAppTwoPntsAssign);
00065   num_fail += RUN_TEST(testRuleAppConstructorExceptions);
00066   num_fail += RUN_TEST(testRuleAppRangeExceptions);
00067 
00068   return num_fail;
00069 }
00070 
00071 void makeTriangle(AF2Point2D const & v0, AF2Point2D const & v1,
00072     AF2Point2D const & v2, AF2Polygon2D* & trianglePtr)
00073 {
00074   std::list<const AF2Point2D*> triangleVertices;
00075   triangleVertices.push_back(&v0);
00076   triangleVertices.push_back(&v1);
00077   triangleVertices.push_back(&v2);
00078   trianglePtr = new AF2Polygon2D(triangleVertices);
00079 }
00080 
00081 AF2Polygon2D* makeQuad(AF2Point2D const & v0, AF2Point2D const & v1,
00082     AF2Point2D const & v2, AF2Point2D const & v3)
00083 {
00084   std::list<const AF2Point2D*> quadVertices;
00085   quadVertices.push_back(&v0);
00086   quadVertices.push_back(&v1);
00087   quadVertices.push_back(&v2);
00088   quadVertices.push_back(&v3);
00089   return new AF2Polygon2D(quadVertices);
00090 }
00091 
00097 AF2RuleApplication* makeZeroNewPointsRuleApplication(AF2Point2D const & v0,
00098     AF2Point2D const & v1, AF2Point2D const & v2)
00099 {
00100   // make the triangle from the existing vertices
00101   AF2Polygon2D* ruleAppTriangle = NULL;
00102   makeTriangle(v0, v1, v2, ruleAppTriangle);
00103 
00104   // make an empty list of points -- there are no new points in the rule app
00105   std::list<const AF2Point2D*> ruleAppNewPoints;
00106 
00107   // make a list of polygons containing the triangle
00108   std::list<const AF2Polygon2D*> ruleAppFaces;
00109   ruleAppFaces.push_back(ruleAppTriangle);
00110 
00111   // construct the rule application
00112   AF2RuleApplication* ruleApplication =
00113       new AF2RuleApplication(ruleAppNewPoints, ruleAppFaces);
00114 
00115   // delete the triangle, which should have been copied in the rule
00116   // application constructor
00117   delete ruleAppTriangle;
00118 
00119   // return the rule application
00120   return ruleApplication;
00121 }
00122 
00129 AF2RuleApplication* makeTwoNewPointsRuleApplication(AF2Point2D const & v0,
00130     AF2Point2D const & v1, double v2x, double v2y, double v3x, double v3y)
00131 {
00132   // make the two new points that will be stored in the rule application
00133   AF2Point2D* v2 = new AF2Point2D(v2x, v2y);
00134   AF2Point2D* v3 = new AF2Point2D(v3x, v3y);
00135 
00136   // make the quadrilateral from the two existing and two new vertices
00137   AF2Polygon2D* ruleAppQuad = makeQuad(v0, v1, *v2, *v3);
00138 
00139   // make a list of the new points
00140   // the order should not matter
00141   std::list<const AF2Point2D*> ruleAppNewPoints;
00142   ruleAppNewPoints.push_back(v3);
00143   ruleAppNewPoints.push_back(v2);
00144 
00145   // make a list of polygons containing the quadrilateral
00146   std::list<const AF2Polygon2D*> ruleAppFaces;
00147   ruleAppFaces.push_back(ruleAppQuad);
00148 
00149   // construct the rule application
00150   AF2RuleApplication* ruleApplication =
00151       new AF2RuleApplication(ruleAppNewPoints, ruleAppFaces);
00152 
00153   // delete the new points and the quadrilateral, which all should
00154   // have been copied to new memory owned by the rule application
00155   delete ruleAppQuad;
00156   delete v3;
00157   delete v2;
00158 
00159   // return the rule application
00160   return ruleApplication;
00161 }
00162 
00163 void testPolygonCreateDestroy()
00164 {
00165   AF2Point2D v0(0, 0);
00166   AF2Point2D v1(1, 0);
00167   AF2Point2D v2(0.5, 0.8);
00168   AF2Polygon2D* trianglePtr;
00169   makeTriangle(v0, v1, v2, trianglePtr);
00170 
00171   CHECK_EQUAL(trianglePtr->getNumVertices(), 3u);
00172   std::cout << "Good: The triangle has 3 vertices." << std::endl;
00173   CHECK(trianglePtr->getVertex(0) == &v0);
00174   std::cout << "Good: The vertex at index 0 matches expectation." << std::endl;
00175   CHECK(trianglePtr->getVertex(1) == &v1);
00176   std::cout << "Good: The vertex at index 1 matches expectation." << std::endl;
00177   CHECK(trianglePtr->getVertex(2) == &v2);
00178   std::cout << "Good: The vertex at index 2 matches expectation." << std::endl;
00179 
00180   delete trianglePtr;
00181 
00182   std::cout << "PASS: The triangle can be constructed and deleted."
00183       << std::endl;
00184 }
00185 
00186 void testPolygonCopy()
00187 {
00188   AF2Point2D v0(0, 0);
00189   AF2Point2D v1(1, 0);
00190   AF2Point2D v2(0.5, 0.8);
00191   AF2Polygon2D* trianglePtr;
00192   makeTriangle(v0, v1, v2, trianglePtr);
00193 
00194   AF2Polygon2D copiedTriangle(*trianglePtr);
00195   delete trianglePtr;
00196   CHECK(copiedTriangle.getNumVertices() == 3 &&
00197       copiedTriangle.getVertex(0) == &v0 &&
00198       copiedTriangle.getVertex(1) == &v1 &&
00199       copiedTriangle.getVertex(2) == &v2);
00200 
00201   std::cout << "PASS: The copied triangle matches expectations." << std::endl;
00202 }
00203 
00204 void testPolygonAssign()
00205 {
00206   AF2Point2D v0(0, 0);
00207   AF2Point2D v1(1, 0);
00208   AF2Point2D v2(0.5, 0.8);
00209   AF2Polygon2D* trianglePtr;
00210   makeTriangle(v0, v1, v2, trianglePtr);
00211 
00212   AF2Point2D v3(5, 5);
00213   AF2Point2D v4(6, 5);
00214   AF2Point2D v5(5.5, 5.8);
00215   AF2Polygon2D* otherTrianglePtr;
00216   makeTriangle(v3, v4, v5, otherTrianglePtr);
00217 
00218   AF2Polygon2D assignedTriangle(*otherTrianglePtr);
00219   delete otherTrianglePtr;
00220   assignedTriangle = *trianglePtr;
00221   delete trianglePtr;
00222   CHECK(assignedTriangle.getNumVertices() == 3 &&
00223       assignedTriangle.getVertex(0) == &v0 &&
00224       assignedTriangle.getVertex(1) == &v1 &&
00225       assignedTriangle.getVertex(2) == &v2);
00226   std::cout << "PASS: The triangle produced by assignment matches expectations."
00227       << std::endl;
00228 }
00229 
00230 void testPolygonConstructorException()
00231 {
00232   AF2Point2D v0(0, 0);
00233   AF2Point2D v1(1, 0);
00234 
00235   std::list<const AF2Point2D*> badVertexList;
00236   badVertexList.push_back(&v0);
00237   badVertexList.push_back(NULL);
00238   badVertexList.push_back(&v1);
00239   bool exceptionThrown = false;
00240   try
00241   {
00242     AF2Polygon2D* shouldFail = new AF2Polygon2D(badVertexList);
00243     delete shouldFail;
00244   }
00245   catch (MeshKit::Error& mkError)
00246   {
00247     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00248     std::cout << "Good: The error is a bad input error." << std::endl;
00249     exceptionThrown = true;
00250   }
00251 
00252   CHECK(exceptionThrown);
00253   std::cout << "PASS: A null pointer in the vertex list passed to the\n"
00254       << "  constructor caused an exception." << std::endl;
00255 }
00256 
00257 void testPolygonRangeException()
00258 {
00259   AF2Point2D v0(0, 0);
00260   AF2Point2D v1(1, 0);
00261   AF2Point2D v2(0.5, 0.8);
00262   AF2Polygon2D* trianglePtr;
00263   makeTriangle(v0, v1, v2, trianglePtr);
00264 
00265   bool exceptionThrown = false;
00266   try
00267   {
00268     trianglePtr->getVertex(3);
00269   }
00270   catch (MeshKit::Error& mkError)
00271   {
00272     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00273     std::cout << "Good: The error is a bad input error." << std::endl;
00274     exceptionThrown = true;
00275   }
00276 
00277   delete trianglePtr;
00278   CHECK(exceptionThrown);
00279   std::cout << "PASS: An index out of range passed to the getVertex() method\n"
00280       << "  caused an exception." << std::endl;
00281 }
00282 
00283 void testRuleAppZeroPntsCreateDestroy()
00284 {
00285   AF2Point2D v0(0, 0);
00286   AF2Point2D v1(1, 0);
00287   AF2Point2D v2(0.5, 0.8);
00288   AF2RuleApplication* ruleApplication =
00289       makeZeroNewPointsRuleApplication(v0, v1, v2);
00290 
00291   CHECK_EQUAL(ruleApplication->getNumNewPoints(), 0u);
00292   std::cout << "Good: The rule application has 0 new points." << std::endl;
00293   CHECK_EQUAL(ruleApplication->getNumNewFaces(), 1u);
00294   std::cout << "Good: The rule application has 1 new face." << std::endl;
00295   const AF2Polygon2D* newFace = ruleApplication->getNewFace(0u);
00296   CHECK(newFace->getVertex(0u) == &v0);
00297   std::cout
00298       << "Good: The vertex at index 0 of the new face matches expectation."
00299       << std::endl;
00300   CHECK(newFace->getVertex(1u) == &v1);
00301   std::cout
00302       << "Good: The vertex at index 1 of the new face matches expectation."
00303       << std::endl;
00304   CHECK(newFace->getVertex(2u) == &v2);
00305   std::cout
00306       << "Good: The vertex at index 2 of the new face matches expectation."
00307       << std::endl;
00308 
00309   delete ruleApplication;
00310 
00311   std::cout << "PASS: The rule application with no new points\n"
00312       << "  can be constructed and deleted." << std::endl;
00313 }
00314 
00315 void testRuleAppZeroPntsCopy()
00316 {
00317   AF2Point2D v0(0, 0);
00318   AF2Point2D v1(1, 0);
00319   AF2Point2D v2(0.5, 0.8);
00320   AF2RuleApplication* ruleApplication =
00321       makeZeroNewPointsRuleApplication(v0, v1, v2);
00322 
00323   AF2RuleApplication copiedRuleApplication(*ruleApplication);
00324   delete ruleApplication;
00325   const AF2Polygon2D* newFace = copiedRuleApplication.getNewFace(0u);
00326   CHECK(copiedRuleApplication.getNumNewPoints() == 0u &&
00327       copiedRuleApplication.getNumNewFaces() == 1u &&
00328       newFace->getVertex(0u) == &v0 &&
00329       newFace->getVertex(1u) == &v1 &&
00330       newFace->getVertex(2u) == &v2);
00331 
00332   std::cout << "PASS: The copied rule application matches expectations."
00333       << std::endl;
00334 }
00335 
00336 void testRuleAppZeroPntsAssign()
00337 {
00338   AF2Point2D v0(0, 0);
00339   AF2Point2D v1(1, 0);
00340   AF2Point2D v2(0.5, 0.8);
00341   AF2RuleApplication* ruleApplication =
00342       makeZeroNewPointsRuleApplication(v0, v1, v2);
00343 
00344   AF2Point2D v3(5, 5);
00345   AF2Point2D v4(6, 5);
00346   AF2Point2D v5(5.5, 5.8);
00347   AF2RuleApplication* otherRuleApplication =
00348       makeZeroNewPointsRuleApplication(v3, v4, v5);
00349 
00350   AF2RuleApplication assignedRuleApplication(*otherRuleApplication);
00351   delete otherRuleApplication;
00352   assignedRuleApplication = *ruleApplication;
00353   delete ruleApplication;
00354 
00355   const AF2Polygon2D* newFace = assignedRuleApplication.getNewFace(0u);
00356   CHECK(assignedRuleApplication.getNumNewPoints() == 0u &&
00357       assignedRuleApplication.getNumNewFaces() == 1u &&
00358       newFace->getVertex(0u) == &v0 &&
00359       newFace->getVertex(1u) == &v1 &&
00360       newFace->getVertex(2u) == &v2);
00361 
00362   std::cout << "PASS: The rule application produced by assignment matches\n"
00363       << "  expectations." << std::endl;
00364 }
00365 
00366 void testRuleAppTwoPntsCreateDestroy()
00367 {
00368   AF2Point2D v0(0, 0);
00369   AF2Point2D v1(1, 0);
00370   AF2RuleApplication* ruleApplication =
00371       makeTwoNewPointsRuleApplication(v0, v1, 1.0625, 1.0, 0.125, 0.875);
00372 
00373   CHECK_EQUAL(ruleApplication->getNumNewPoints(), 2u);
00374   std::cout << "Good: The rule application has 2 new points." << std::endl;
00375   const AF2Point2D* v2 = ruleApplication->getNewPoint(1u);
00376   const AF2Point2D* v3 = ruleApplication->getNewPoint(0u);
00377   CHECK_REAL_EQUAL(1.0625, v2->getX(), 0.0);
00378   CHECK_REAL_EQUAL(1.0, v2->getY(), 0.0);
00379   CHECK_REAL_EQUAL(0.125, v3->getX(), 0.0);
00380   CHECK_REAL_EQUAL(0.875, v3->getY(), 0.0);
00381   std::cout << "Good: The new points have the expected coordinates."
00382       << std::endl;
00383   CHECK_EQUAL(ruleApplication->getNumNewFaces(), 1u);
00384   std::cout << "Good: The rule application has 1 new face." << std::endl;
00385   const AF2Polygon2D* newFace = ruleApplication->getNewFace(0u);
00386   CHECK(newFace->getVertex(0u) == &v0);
00387   std::cout
00388       << "Good: The vertex at index 0 of the new face matches expectation."
00389       << std::endl;
00390   CHECK(newFace->getVertex(1u) == &v1);
00391   std::cout
00392       << "Good: The vertex at index 1 of the new face matches expectation."
00393       << std::endl;
00394   CHECK(newFace->getVertex(2u) == v2);
00395   std::cout
00396       << "Good: The vertex at index 2 of the new face matches expectation."
00397       << std::endl;
00398   CHECK(newFace->getVertex(3u) == v3);
00399   std::cout
00400       << "Good: The vertex at index 3 of the new face matches expectation."
00401       << std::endl;
00402 
00403   delete ruleApplication;
00404 
00405   std::cout << "PASS: The rule application with two new points\n"
00406       << "  can be constructed and deleted." << std::endl;
00407 }
00408 
00409 void testRuleAppTwoPntsCopy()
00410 {
00411   AF2Point2D v0(0, 0);
00412   AF2Point2D v1(1, 0);
00413   AF2RuleApplication* ruleApplication =
00414       makeTwoNewPointsRuleApplication(v0, v1, 1.0625, 1.0, 0.125, 0.875);
00415 
00416   AF2RuleApplication copiedRuleApplication(*ruleApplication);
00417   CHECK(copiedRuleApplication.getNumNewPoints() == 2u &&
00418       copiedRuleApplication.getNumNewFaces() == 1u);
00419   std::cout << "Good: The copied rule application has the expected\n"
00420       << "  number of new points and new faces." << std::endl;
00421   const AF2Point2D* originalV2 = ruleApplication->getNewPoint(1u);
00422   const AF2Point2D* v2 = copiedRuleApplication.getNewPoint(1u);
00423   CHECK(originalV2 != v2);
00424   std::cout << "Good: The first new point in the copied rule is a different\n"
00425       << "  object than the first new point in the original rule."
00426       << std::endl;
00427   delete ruleApplication;
00428   v2 = copiedRuleApplication.getNewPoint(1u);
00429   const AF2Point2D* v3 = copiedRuleApplication.getNewPoint(0u);
00430   CHECK_REAL_EQUAL(1.0625, v2->getX(), 0.0);
00431   CHECK_REAL_EQUAL(1.0, v2->getY(), 0.0);
00432   CHECK_REAL_EQUAL(0.125, v3->getX(), 0.0);
00433   CHECK_REAL_EQUAL(0.875, v3->getY(), 0.0);
00434   const AF2Polygon2D* newFace = copiedRuleApplication.getNewFace(0u);
00435   CHECK(copiedRuleApplication.getNumNewPoints() == 2u &&
00436       copiedRuleApplication.getNumNewFaces() == 1u &&
00437       newFace->getVertex(0u) == &v0 &&
00438       newFace->getVertex(1u) == &v1 &&
00439       newFace->getVertex(2u) == v2 &&
00440       newFace->getVertex(3u) == v3);
00441 
00442   std::cout << "PASS: The copied rule application matches expectations."
00443       << std::endl;
00444 }
00445 
00446 void testRuleAppTwoPntsAssign()
00447 {
00448   AF2Point2D v0(0, 0);
00449   AF2Point2D v1(1, 0);
00450   AF2RuleApplication* ruleApplication =
00451       makeTwoNewPointsRuleApplication(v0, v1, 1.0625, 1.0, 0.125, 0.875);
00452   const AF2Point2D* originalV2 = ruleApplication->getNewPoint(1u);
00453 
00454   AF2Point2D v4(5, 5);
00455   AF2Point2D v5(6, 5);
00456   AF2RuleApplication* otherRuleApplication =
00457       makeTwoNewPointsRuleApplication(v4, v5, 6.0, 5.0625, 5.875, 5.125);
00458 
00459   AF2RuleApplication assignedRuleApplication(*otherRuleApplication);
00460   delete otherRuleApplication;
00461   assignedRuleApplication = *ruleApplication;
00462   // this should makes originalV2 a dangling pointer, but the code can
00463   // still check (later) that it is pointing to a different location than v2
00464   delete ruleApplication;
00465 
00466   const AF2Point2D* v2 = assignedRuleApplication.getNewPoint(1u);
00467   const AF2Point2D* v3 = assignedRuleApplication.getNewPoint(0u);
00468   CHECK_REAL_EQUAL(1.0625, v2->getX(), 0.0);
00469   CHECK_REAL_EQUAL(1.0, v2->getY(), 0.0);
00470   CHECK_REAL_EQUAL(0.125, v3->getX(), 0.0);
00471   CHECK_REAL_EQUAL(0.875, v3->getY(), 0.0);
00472   const AF2Polygon2D* newFace = assignedRuleApplication.getNewFace(0u);
00473   CHECK(assignedRuleApplication.getNumNewPoints() == 2u &&
00474       assignedRuleApplication.getNumNewFaces() == 1u &&
00475       originalV2 != v2 &&
00476       newFace->getVertex(0u) == &v0 &&
00477       newFace->getVertex(1u) == &v1 &&
00478       newFace->getVertex(2u) == v2 &&
00479       newFace->getVertex(3u) == v3);
00480 
00481   std::cout << "PASS: The rule application produced by assignment matches\n"
00482       << "  expectations." << std::endl;
00483 }
00484 
00485 void testRuleAppConstructorExceptions()
00486 {
00487   AF2Point2D v0(0, 0);
00488   AF2Point2D v1(1, 0);
00489   AF2Point2D v2(0.5, 0.8);
00490   AF2Polygon2D* trianglePtr = NULL;
00491   makeTriangle(v0, v1, v2, trianglePtr);
00492 
00493   std::list<const AF2Point2D*> badNewPointsList;
00494   badNewPointsList.push_back(NULL);
00495   badNewPointsList.push_back(&v2);
00496 
00497   std::list<const AF2Polygon2D*> goodNewFacesList;
00498   goodNewFacesList.push_back(trianglePtr);
00499 
00500   bool exceptionThrown = false;
00501   try
00502   {
00503     AF2RuleApplication* shouldFail =
00504         new AF2RuleApplication(badNewPointsList, goodNewFacesList);
00505     delete shouldFail;
00506   }
00507   catch (MeshKit::Error& mkError)
00508   {
00509     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00510     std::cout << "Good: The error is a bad input error." << std::endl;
00511     exceptionThrown = true;
00512   }
00513 
00514   CHECK(exceptionThrown);
00515   std::cout << "Good: A null pointer in the list of new points passed to the\n"
00516       << "  constructor caused an exception." << std::endl;
00517 
00518   std::list<const AF2Point2D*> goodNewPointsList;
00519   goodNewPointsList.push_back(&v2);
00520 
00521   std::list<const AF2Polygon2D*> badNewFacesList;
00522   badNewFacesList.push_back(trianglePtr);
00523   badNewFacesList.push_back(NULL);
00524 
00525   exceptionThrown = false;
00526   try
00527   {
00528     AF2RuleApplication* shouldFail =
00529         new AF2RuleApplication(goodNewPointsList, badNewFacesList);
00530     delete shouldFail;
00531   }
00532   catch (MeshKit::Error& mkError)
00533   {
00534     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00535     std::cout << "Good: The error is a bad input error." << std::endl;
00536     exceptionThrown = true;
00537   }
00538 
00539   CHECK(exceptionThrown);
00540   std::cout << "Good: A null pointer in the list of new faces passed to the\n"
00541       << "  constructor caused an exception." << std::endl;
00542   std::cout << "PASS: Exceptions were thrown in both cases." << std::endl;
00543 }
00544 
00545 void testRuleAppRangeExceptions()
00546 {
00547   AF2Point2D v0(0, 0);
00548   AF2Point2D v1(1, 0);
00549   AF2Point2D v2(0.5, 0.8);
00550   AF2RuleApplication* ruleApplication =
00551       makeZeroNewPointsRuleApplication(v0, v1, v2);
00552 
00553   bool exceptionThrown = false;
00554   try
00555   {
00556     ruleApplication->getNewPoint(0);
00557   }
00558   catch (MeshKit::Error& mkError)
00559   {
00560     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00561     std::cout << "Good: The error is a bad input error." << std::endl;
00562     exceptionThrown = true;
00563   }
00564 
00565   CHECK(exceptionThrown);
00566   std::cout << "Good: An index out of range passed to the getNewPoint()\n"
00567       << "  method caused an exception." << std::endl;
00568 
00569   exceptionThrown = false;
00570   try
00571   {
00572     ruleApplication->getNewFace(1);
00573   }
00574   catch (MeshKit::Error& mkError)
00575   {
00576     CHECK_EQUAL(mkError.error_code(), MeshKit::MK_BAD_INPUT);
00577     std::cout << "Good: The error is a bad input error." << std::endl;
00578     exceptionThrown = true;
00579   }
00580 
00581   delete ruleApplication;
00582   CHECK(exceptionThrown);
00583   std::cout << "Good: An index out of range passed to the getNewFace()\n"
00584       << "  method caused an exception." << std::endl;
00585   std::cout << "PASS: Exceptions were thrown in both cases." << std::endl;
00586 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines