X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fengine%2FTest%2FengineTest.cxx;h=06680baf97b7d2049435600454a03a1fdf316d02;hb=eb87b5afd7d814cdce825c6e75342001fe01b978;hp=e0a1fc22083dbeea435d02726c4604c6dc24f46e;hpb=c81be9b5e74b26e207bd6efd0ccf68418ac536a3;p=modules%2Fyacs.git diff --git a/src/engine/Test/engineTest.cxx b/src/engine/Test/engineTest.cxx index e0a1fc220..06680baf9 100644 --- a/src/engine/Test/engineTest.cxx +++ b/src/engine/Test/engineTest.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2012 CEA/DEN, EDF R&D +// Copyright (C) 2006-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,6 +26,7 @@ #include "Loop.hxx" #include "Switch.hxx" #include "VisitorSaveState.hxx" +#include "SetOfPoints.hxx" #include "SharedPtr.hxx" #include "RuntimeForEngineTest.hxx" @@ -1072,3 +1073,177 @@ void EngineTest::checkLogger() CPPUNIT_ASSERT(logger->getStr()==expected2); delete proc; } + +void EngineTest::checkGraphAnalyser0() +{ + { + static const int N=2; + Bloc *t[N]; + Bloc proc("proc"); + for(int i=0;i > r(proc.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)r.size()); + CPPUNIT_ASSERT_EQUAL(N,(int)r[0].size()); + SetOfPoints sop(r[0]); + sop.simplify(); + CPPUNIT_ASSERT(sop.getRepr()=="(n1+n2) - "); + } +} + +void EngineTest::checkGraphAnalyser1() +{ + { + static const int N=24; + Bloc *t[N]; + Bloc proc("proc"); + for(int i=0;i > r(proc.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)r.size()); + CPPUNIT_ASSERT_EQUAL(N,(int)r[0].size()); + SetOfPoints sop(r[0]); + sop.simplify(); + CPPUNIT_ASSERT(sop.getRepr()=="([n21*n23]+(n22+n16+[((n13+n12)+[n10*n11]+(n9+n8+n7))*((n17+n18+n20)+[n19*n3*n4]+n5)*(n15+[(n1+n2+n24)*n14])]+n6)) - "); + } + // + { + static const int N=10; + Bloc *t[N]; + Bloc proc("proc"); + for(int i=0;i > r(proc.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)r.size()); + CPPUNIT_ASSERT_EQUAL(N,(int)r[0].size()); + SetOfPoints sop(r[0]); + sop.simplify(); + CPPUNIT_ASSERT(sop.getRepr()=="((n10+n1)+[([(n9+n4)*n3]+n5)*(n2+n7+n8)]+n6) - "); + } +} + +void EngineTest::checkGraphAnalyser2() +{ + { + static const int N=8; + Bloc *t[N]; + Bloc proc("proc"); + for(int i=0;i > r(proc.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)r.size()); + CPPUNIT_ASSERT_EQUAL(N,(int)r[0].size()); + SetOfPoints sop(r[0]); + sop.simplify(); + CPPUNIT_ASSERT(sop.getRepr()=="((n8+n5)+[(n1+n2)*(n3+n4)]+(n6+n7)) - "); + } + // + { + static const int NN=6; + Bloc *tt[NN]; + Bloc proc2("proc2"); + tt[0]=new Bloc("n21") ; tt[1]=new Bloc("n22") ; tt[2]=new Bloc("n23") ; tt[3]=new Bloc("n16"); tt[4]=new Bloc("n21@1"); tt[5]=new Bloc("n23@1"); + for(int i=0;i > rr(proc2.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)rr.size()); + CPPUNIT_ASSERT_EQUAL(NN,(int)rr[0].size()); + SetOfPoints sop2(rr[0]); + sop2.simplify(); + CPPUNIT_ASSERT(sop2.getRepr()=="([(n21+n21@1)*(n23+n23@1)]+(n22+n16)) - "); + } + // + { + static const int NNN=6; + Bloc *ttt[NNN]; + Bloc proc3("proc3"); + ttt[0]=new Bloc("n21") ; ttt[1]=new Bloc("n22") ; ttt[2]=new Bloc("n23") ; ttt[3]=new Bloc("n16"); ttt[4]=new Bloc("n21@1"); ttt[5]=new Bloc("n23@1"); + for(int i=0;i > rrr(proc3.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)rrr.size()); + CPPUNIT_ASSERT_EQUAL(NNN,(int)rrr[0].size()); + SetOfPoints sop3(rrr[0]); + sop3.simplify(); + CPPUNIT_ASSERT(sop3.getRepr()=="((n22+n16)+[(n21+n21@1)*(n23+n23@1)]) - "); + } +} + +void EngineTest::checkGraphAnalyser3() +{ + { + static const int NNN=6; + Bloc *ttt[NNN]; + Bloc proc3("proc3"); + for(int i=0;i > rrr(proc3.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)rrr.size()); + CPPUNIT_ASSERT_EQUAL(NNN,(int)rrr[0].size()); + SetOfPoints sop3(rrr[0]); + //sop3.simplify(); + //std:cerr << std::endl << sop3.getRepr() << std::endl; + //CPPUNIT_ASSERT(sop3.getRepr()=="((n22+n16)+[(n21+n21@1)*(n23+n23@1)]) - "); + } +} + +void EngineTest::checkGraphAnalyser4() +{ + { + static const int NNN=3; + Bloc *ttt[NNN]; + Bloc proc3("proc"); + for(int i=0;i > rrr(proc3.splitIntoIndependantGraph()); + CPPUNIT_ASSERT_EQUAL(1,(int)rrr.size()); + CPPUNIT_ASSERT_EQUAL(NNN,(int)rrr[0].size()); + SetOfPoints sop(rrr[0]); + sop.simplify(); + CPPUNIT_ASSERT(sop.getRepr()=="(n3+n2+n1) - "); + } +}