From 4bb78e4fd3c00ed7d34c598ab4e83987d7b5858b Mon Sep 17 00:00:00 2001 From: Vincent BLAIN Date: Mon, 1 Aug 2022 11:27:11 +0200 Subject: [PATCH] [98] PrimitiveType modification Rename all use of PrimitiveType unicode '\u2115', '\u211D', '\u213E' by int, real and bool. Generated code and LaTeX view are unchanged. Bug: https://github.com/cea-hpc/NabLab/issues/98 Signed-off-by: Vincent BLAIN --- plugins/fr.cea.nabla.ir/model/Ir.ecore | 6 +- .../ExplicitHeatEquation.n | 30 +-- .../NabLabExamples/src/glace2d/Glace2d.n | 74 +++--- .../src/heatequation/HeatEquation.n | 16 +- .../ImplicitHeatEquation.n | 30 +-- .../IterativeHeatEquation.n | 36 +-- .../ui/wizards/NewNablaProjectWizard.xtend | 12 +- .../fr.cea.nabla/model/generated/Nabla.ecore | 6 +- .../model/generated/Nabla.genmodel | 2 +- .../model/generated/Nablagen.genmodel | 2 +- plugins/fr.cea.nabla/nablalib/Assert.n | 12 +- plugins/fr.cea.nabla/nablalib/LinearAlgebra.n | 16 +- plugins/fr.cea.nabla/nablalib/Math.n | 64 ++--- .../src/fr/cea/nabla/LatexLabelServices.xtend | 224 +++++++++-------- .../fr.cea.nabla/src/fr/cea/nabla/Nabla.xtext | 2 +- .../cea/nabla/validation/BasicValidator.xtend | 4 +- .../FunctionOrReductionValidator.xtend | 2 +- tests/BathyLib/src/bathylib/BathyLib.n | 10 +- tests/DepthInit/src/depthinit/DepthInit.n | 12 +- tests/NabLabDrafts/src/reduction/Reduction.n | 18 +- tests/NabLabTests/src/hydroremap/Hydro.n | 24 +- tests/NabLabTests/src/hydroremap/Remap.n | 2 +- tests/NabLabTests/src/iteration/Iteration.n | 22 +- tests/NabLabTests/src/variables/Variables.n | 56 ++--- .../nabla/tests/ConstExprServicesTest.xtend | 20 +- .../nabla/tests/DeclarationProviderTest.xtend | 98 ++++---- .../nabla/tests/IteratorExtensionsTest.xtend | 16 +- .../nabla/tests/NablaScopeProviderTest.xtend | 66 ++--- .../tests/NablagenScopeProviderTest.xtend | 16 +- .../src/fr/cea/nabla/tests/TestUtils.xtend | 4 +- ...tractBinaryOperationsInterpreterTest.xtend | 114 ++++----- .../AbstractExpressionInterpreterTest.xtend | 232 +++++++++--------- .../AbstractInstructionInterpreterTest.xtend | 50 ++-- .../AbstractJobInterpreterTest.xtend | 16 +- .../AbstractModuleInterpreterTest.xtend | 6 +- .../AbstractOptionsInterpreterTest.xtend | 22 +- .../CreateArrayOperatorsTest.xtend | 16 +- .../ReplaceAffectationsTest.xtend | 10 +- .../ReplaceOptionsByLocalVariablesTest.xtend | 6 +- .../ArgOrVarTypeProviderTest.xtend | 62 ++--- .../ExpressionTypeProviderTest.xtend | 116 ++++----- .../validation/ArgOrVarRefValidatorTest.xtend | 64 ++--- .../tests/validation/BasicValidatorTest.xtend | 122 ++++----- .../validation/ExpressionValidatorTest.xtend | 222 ++++++++--------- .../FunctionOrReductionValidatorTest.xtend | 70 +++--- .../validation/InstructionValidatorTest.xtend | 68 ++--- .../validation/NablagenValidatorTest.xtend | 32 +-- .../validation/UniqueNameValidatorTest.xtend | 28 +-- .../validation/UnusedValidatorTest.xtend | 24 +- 49 files changed, 1097 insertions(+), 1085 deletions(-) diff --git a/plugins/fr.cea.nabla.ir/model/Ir.ecore b/plugins/fr.cea.nabla.ir/model/Ir.ecore index a88cac7d6..9dd6a64ea 100644 --- a/plugins/fr.cea.nabla.ir/model/Ir.ecore +++ b/plugins/fr.cea.nabla.ir/model/Ir.ecore @@ -382,9 +382,9 @@ - - - + + + ε && check(k+1 < maxIterationsK)); @@ -54,9 +54,9 @@ ComputeFaceConductivity: ∀f∈faces(), faceConductivity{f} = 2.0 * ∏{c1∈ce // Assembling of the diffusion matrix ComputeAlphaCoeff: ∀c∈cells(), { - let ℝ αDiag = 0.0; + let real αDiag = 0.0; ∀d∈neighbourCells(c), ∀f∈commonFace(c,d), { - let ℝ αExtraDiag = δt / V{c} * (faceLength{f} * faceConductivity{f}) / norm(Xc{c} - Xc{d}); + let real αExtraDiag = δt / V{c} * (faceLength{f} * faceConductivity{f}) / norm(Xc{c} - Xc{d}); α{c, d} = αExtraDiag; αDiag = αDiag + αExtraDiag; } diff --git a/plugins/fr.cea.nabla.ui/src/fr/cea/nabla/ui/wizards/NewNablaProjectWizard.xtend b/plugins/fr.cea.nabla.ui/src/fr/cea/nabla/ui/wizards/NewNablaProjectWizard.xtend index 5fb973533..982f88e79 100644 --- a/plugins/fr.cea.nabla.ui/src/fr/cea/nabla/ui/wizards/NewNablaProjectWizard.xtend +++ b/plugins/fr.cea.nabla.ui/src/fr/cea/nabla/ui/wizards/NewNablaProjectWizard.xtend @@ -256,12 +256,12 @@ class NewNablaProjectWizard extends Wizard implements INewWizard with CartesianMesh2D.*; - let ℕ maxIter = 200; - let ℝ maxTime = 1.0; + let int maxIter = 200; + let real maxTime = 1.0; - ℝ t, δt; - ℝ[2] X{nodes}; - ℝ e{nodes}; + real t, δt; + real[2] X{nodes}; + real e{nodes}; iterate n while (n+1 < maxIter && t^{n+1} < maxTime); ''' @@ -270,7 +270,7 @@ class NewNablaProjectWizard extends Wizard implements INewWizard ''' extension «extensionName»; - def myMatVectProduct: x, y | ℝ[x,y] × ℝ[y] → ℝ[x]; + def myMatVectProduct: x, y | real[x,y] × real[y] → real[x]; ''' private def getManifestContent() diff --git a/plugins/fr.cea.nabla/model/generated/Nabla.ecore b/plugins/fr.cea.nabla/model/generated/Nabla.ecore index 3f6f2a97a..debfa634e 100644 --- a/plugins/fr.cea.nabla/model/generated/Nabla.ecore +++ b/plugins/fr.cea.nabla/model/generated/Nabla.ecore @@ -225,9 +225,9 @@ eType="#//Expression" containment="true"/> - - - + + + diff --git a/plugins/fr.cea.nabla/model/generated/Nabla.genmodel b/plugins/fr.cea.nabla/model/generated/Nabla.genmodel index d36ff7280..2127431c2 100644 --- a/plugins/fr.cea.nabla/model/generated/Nabla.genmodel +++ b/plugins/fr.cea.nabla/model/generated/Nabla.genmodel @@ -1,6 +1,6 @@ 0) target.name.pu + '+' + inc @@ -189,30 +190,41 @@ class LatexLabelServices if (!indices.empty) label += '\\left[' + indices.map[x | x.latex].join(',') + '\\right]' return label } - - /* TYPES *************************************************/ - static def dispatch String getLatex(BaseType it) - { - if (sizes.empty) - primitive.literal - else - primitive.literal + '^{' + sizes.map[x | x.latex].join(' \\times ') + '}' - } - - private static def getLatexArg(Expression it) - { - if (it instanceof ReductionCall || it instanceof FunctionCall) - latex - else - '\\left(' + latex + '\\right)' - } - - // PRESERVE UNDERSCORES - private static def String pu(String it) - { - val ret = if (!nullOrEmpty) replaceAll('_', '\\\\_') else '' + + /* TYPES *************************************************/ + static def dispatch String getLatex(PrimitiveType it) + { + switch it + { + case REAL : '\u211D' + case INT : '\u2115' + case BOOL : '\u213E' + } + } + + static def dispatch String getLatex(BaseType it) + { + var primUnicode = getLatex(primitive) + if (sizes.empty) + primUnicode + else + primUnicode + '^{' + sizes.map[x | x.latex].join(' \\times ') + '}' + } + + private static def getLatexArg(Expression it) + { + if (it instanceof ReductionCall || it instanceof FunctionCall) + latex + else + '\\left(' + latex + '\\right)' + } + + // PRESERVE UNDERSCORES + private static def String pu(String it) + { + val ret = if (!nullOrEmpty) replaceAll('_', '\\\\_') else '' return ret.replace('\u03B4', '\\delta ') - } + } /** Return the highest displayable object, Job, Instruction or Expression */ static def EObject getClosestDisplayableNablaElt(EObject elt) diff --git a/plugins/fr.cea.nabla/src/fr/cea/nabla/Nabla.xtext b/plugins/fr.cea.nabla/src/fr/cea/nabla/Nabla.xtext index 146a88233..fa16c0719 100644 --- a/plugins/fr.cea.nabla/src/fr/cea/nabla/Nabla.xtext +++ b/plugins/fr.cea.nabla/src/fr/cea/nabla/Nabla.xtext @@ -154,7 +154,7 @@ ArgOrVarRef: target=[ArgOrVar] /* TYPES *************************************************/ -enum PrimitiveType: Int='\u2115' | Real='\u211D' | Bool='\u213E'; +enum PrimitiveType: Int='int' | Real='real' | Bool='bool'; BaseType: primitive=PrimitiveType ('[' sizes+=Expression (',' sizes+=Expression)* ']')?; diff --git a/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/BasicValidator.xtend b/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/BasicValidator.xtend index 1110fc0ec..648d1d109 100644 --- a/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/BasicValidator.xtend +++ b/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/BasicValidator.xtend @@ -257,8 +257,8 @@ class BasicValidator extends UnusedValidator /** * Order in connectivities, connectivities with their max size unknown at generation time should be first. - * - Accepted variable: `ℕ toto{cells, nodes, nodesOfCell};` - * - Rejected variable: `ℕ toto{cells, nodesOfCell, nodes};` + * - Accepted variable: `int toto{cells, nodes, nodesOfCell};` + * - Rejected variable: `int toto{cells, nodesOfCell, nodes};` */ @Check(CheckType.NORMAL) def checkDimensionsArgOrder(ConnectivityVar it) diff --git a/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/FunctionOrReductionValidator.xtend b/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/FunctionOrReductionValidator.xtend index 36bd93e6d..faa662bbb 100644 --- a/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/FunctionOrReductionValidator.xtend +++ b/plugins/fr.cea.nabla/src/fr/cea/nabla/validation/FunctionOrReductionValidator.xtend @@ -197,7 +197,7 @@ class FunctionOrReductionValidator extends BasicValidator val seedType = seed?.typeFor // Seed must be scalar and Seed rootType must be the same as Return rootType // If type is Array, the reduction Seed will be used as many times as Array size - // Ex (ℕ.MaxValue, ℝ])→ℕ[2]; -> we will use (ℕ.MaxValue, ℕ.MaxValue) as reduction seed + // Ex (int.MaxValue, real])→int[2]; -> we will use (int.MaxValue, int.MaxValue) as reduction seed if (seedType !== null) { val rType = typeDeclaration.type.primitive diff --git a/tests/BathyLib/src/bathylib/BathyLib.n b/tests/BathyLib/src/bathylib/BathyLib.n index aa33c4ad6..29c72fd41 100644 --- a/tests/BathyLib/src/bathylib/BathyLib.n +++ b/tests/BathyLib/src/bathylib/BathyLib.n @@ -9,9 +9,9 @@ *******************************************************************************/ extension BathyLib; -def nextWaveHeight: → ℝ; -def nextDepth1: x | ℝ × ℝ[x] → ℝ; -def nextDepth2: x, y | ℝ × ℝ[x, y] → ℝ; -def nextDepth3: x | ℝ[x] → ℝ[x]; -def nextDepth4: x, y | ℝ[x, y] → ℝ[x, y]; +def nextWaveHeight: → real; +def nextDepth1: x | real × real[x] → real; +def nextDepth2: x, y | real × real[x, y] → real; +def nextDepth3: x | real[x] → real[x]; +def nextDepth4: x, y | real[x, y] → real[x, y]; diff --git a/tests/DepthInit/src/depthinit/DepthInit.n b/tests/DepthInit/src/depthinit/DepthInit.n index fff7cdc90..a8c61a1aa 100644 --- a/tests/DepthInit/src/depthinit/DepthInit.n +++ b/tests/DepthInit/src/depthinit/DepthInit.n @@ -12,13 +12,13 @@ module DepthInit; with BathyLib.*; with CartesianMesh2D.*; -def two: → ℝ, () → return 2.0; +def two: → real, () → return 2.0; -let ℝ t = 0.0; -ℕ maxIter; -ℝ maxTime, δt; +let real t = 0.0; +int maxIter; +real maxTime, δt; -ℝ[2] X{nodes}; -ℝ η{cells}; +real[2] X{nodes}; +real η{cells}; InitFromFile: ∀j∈cells(), η{j} = two() * nextWaveHeight(); diff --git a/tests/NabLabDrafts/src/reduction/Reduction.n b/tests/NabLabDrafts/src/reduction/Reduction.n index 3ee16d289..3664ba429 100644 --- a/tests/NabLabDrafts/src/reduction/Reduction.n +++ b/tests/NabLabDrafts/src/reduction/Reduction.n @@ -13,19 +13,19 @@ with Math.*; with CartesianMesh2D.*; -def nodeVelocityBoundaryConditionCorner: ℕ × ℝ[2] × ℕ × ℝ[2] × ℝ[2,2] × ℝ[2] × ℝ[2] → ℝ[2], (BC1, BCValue1, BC2, BCValue2, Mp, Gp, lp_np)→ { +def nodeVelocityBoundaryConditionCorner: int × real[2] × int × real[2] × real[2,2] × real[2] × real[2] → real[2], (BC1, BCValue1, BC2, BCValue2, Mp, Gp, lp_np)→ { return [0., 0.]; } // Simulation options -let ℝ maxTime = 0.1; -let ℕ maxIter = 500; -let ℝ δt = 0.01; - -ℝ t; -ℝ[2] X{nodes}; -ℝ[2] Vnode{nodes}; -ℝ[2] lpc_n{nodes, cellsOfNode}; // Corner normal --> "lpc npc" +let real maxTime = 0.1; +let int maxIter = 500; +let real δt = 0.01; + +real t; +real[2] X{nodes}; +real[2] Vnode{nodes}; +real[2] lpc_n{nodes, cellsOfNode}; // Corner normal --> "lpc npc" iterate n while (n <= 2); diff --git a/tests/NabLabTests/src/hydroremap/Hydro.n b/tests/NabLabTests/src/hydroremap/Hydro.n index 4f27acb2d..f2593c4c6 100644 --- a/tests/NabLabTests/src/hydroremap/Hydro.n +++ b/tests/NabLabTests/src/hydroremap/Hydro.n @@ -12,11 +12,11 @@ module Hydro; with CartesianMesh2D.*; with Assert.*; -ℕ maxIter; -ℝ maxTime, δt; -let ℝ t = 0.0; -ℝ[2] X{nodes}; -ℝ hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; +int maxIter; +real maxTime, δt; +let real t = 0.0; +real[2] X{nodes}; +real hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; IniHv1: ∀c∈cells(), hv1{c} = 2.0; IniHv2: ∀c∈cells(), hv2{c} = 0.0; @@ -25,10 +25,10 @@ Hj1: ∀c∈cells(), hv3{c} = hv2{c} + 1.0; Hj2: ∀c∈cells(), hv5{c} = hv3{c} + 2.0; Hj3: ∀c∈cells(), hv7{c} = hv4{c} + hv5{c} + hv6{c}; -OracleHv1: ∀c∈cells(), let ℾ testHv1 = assertEquals(2.0, hv1{c}); -OracleHv2: ∀c∈cells(), let ℾ testHv2 = assertEquals(0.0, hv2{c}); -OracleHv3: ∀c∈cells(), let ℾ testHv3 = assertEquals(1.0, hv3{c}); -OracleHv4: ∀c∈cells(), let ℾ testHv4 = assertEquals(4.0, hv4{c}); -OracleHv5: ∀c∈cells(), let ℾ testHv5 = assertEquals(3.0, hv5{c}); -OracleHv6: ∀c∈cells(), let ℾ testHv6 = assertEquals(6.0, hv6{c}); -OracleHv7: ∀c∈cells(), let ℾ testHv7 = assertEquals(13.0, hv7{c}); +OracleHv1: ∀c∈cells(), let bool testHv1 = assertEquals(2.0, hv1{c}); +OracleHv2: ∀c∈cells(), let bool testHv2 = assertEquals(0.0, hv2{c}); +OracleHv3: ∀c∈cells(), let bool testHv3 = assertEquals(1.0, hv3{c}); +OracleHv4: ∀c∈cells(), let bool testHv4 = assertEquals(4.0, hv4{c}); +OracleHv5: ∀c∈cells(), let bool testHv5 = assertEquals(3.0, hv5{c}); +OracleHv6: ∀c∈cells(), let bool testHv6 = assertEquals(6.0, hv6{c}); +OracleHv7: ∀c∈cells(), let bool testHv7 = assertEquals(13.0, hv7{c}); diff --git a/tests/NabLabTests/src/hydroremap/Remap.n b/tests/NabLabTests/src/hydroremap/Remap.n index c04af234f..a40d96d5b 100644 --- a/tests/NabLabTests/src/hydroremap/Remap.n +++ b/tests/NabLabTests/src/hydroremap/Remap.n @@ -11,7 +11,7 @@ module Remap; with CartesianMesh2D.*; -ℝ rv1{cells}, rv2{cells}, rv3{cells}; +real rv1{cells}, rv2{cells}, rv3{cells}; Rj1: ∀c∈cells(), rv2{c} = rv1{c} * 2.0; Rj2: ∀c∈cells(), rv3{c} = rv2{c} * 3.0; diff --git a/tests/NabLabTests/src/iteration/Iteration.n b/tests/NabLabTests/src/iteration/Iteration.n index 78c221d9b..d1d5f5124 100644 --- a/tests/NabLabTests/src/iteration/Iteration.n +++ b/tests/NabLabTests/src/iteration/Iteration.n @@ -12,17 +12,17 @@ module Iteration; with CartesianMesh2D.*; with Assert.*; -let ℝ maxTime = 0.1; -let ℝ δt = 1.0; +let real maxTime = 0.1; +let real δt = 1.0; -ℝ t; -ℝ[2] X{nodes}; +real t; +real[2] X{nodes}; -let ℕ maxIterN = 10; -let ℕ maxIterK = 6; -let ℕ maxIterL = 7; +let int maxIterN = 10; +let int maxIterK = 6; +let int maxIterL = 7; -ℝ vn{cells}, vk{cells}, vl{cells}; +real vn{cells}, vk{cells}, vl{cells}; iterate n while (n < maxIterN), { k while (k < maxIterK); @@ -36,12 +36,12 @@ UpdateVn: ∀j∈cells(), vn^{n+1}{j} = vn^{n}{j} + vl^{n+1}{j} * 2; IniVk: ∀j∈cells(), vk^{n+1, k=0}{j} = 0.0; UpdateVk: ∀j∈cells(), vk^{n+1, k+1}{j} = vk^{n+1, k}{j} + 2; -OracleVk: ∀j∈cells(), let ℾ testVk = assertEquals(12.0, vk^{n+1}{j}); +OracleVk: ∀j∈cells(), let bool testVk = assertEquals(12.0, vk^{n+1}{j}); IniVl: ∀j∈cells(), vl^{n+1, l=0}{j} = vk^{n+1}{j} + 8; UpdateVl: ∀j∈cells(), vl^{n+1, l+1}{j} = vl^{n+1, l}{j} + 1; -OracleVl: ∀j∈cells(), let ℾ testVl = assertEquals(27.0, vl^{n+1}{j}); +OracleVl: ∀j∈cells(), let bool testVl = assertEquals(27.0, vl^{n+1}{j}); -OracleVn: ∀j∈cells(), let ℾ testVn = assertEquals(54.0*n, vn^{n+1}{j}); +OracleVn: ∀j∈cells(), let bool testVn = assertEquals(54.0*n, vn^{n+1}{j}); ComputeTn: t^{n+1} = t^{n} + δt; diff --git a/tests/NabLabTests/src/variables/Variables.n b/tests/NabLabTests/src/variables/Variables.n index 6a4021196..b3caab9d6 100644 --- a/tests/NabLabTests/src/variables/Variables.n +++ b/tests/NabLabTests/src/variables/Variables.n @@ -13,32 +13,32 @@ with CartesianMesh2D.*; with Assert.*; // Simulation options -let ℝ maxTime = 0.1; -let ℕ maxIter = 500; -let ℝ δt = 1.0; -let ℝ t = 0.0; -ℝ[2] X{nodes}; +let real maxTime = 0.1; +let int maxIter = 500; +let real δt = 1.0; +let real t = 0.0; +real[2] X{nodes}; // options -ℕ optDim; -ℝ[2] optVect1; -ℝ[2] optVect2; -let ℝ[2] optVect3 = optVect1 + optVect2; +int optDim; +real[2] optVect1; +real[2] optVect2; +let real[2] optVect3 = optVect1 + optVect2; // const expr var -let ℕ constexprDim = 2; -let ℝ[constexprDim] constexprVec = [1.1, 1.1]; +let int constexprDim = 2; +let real[constexprDim] constexprVec = [1.1, 1.1]; // variables with default value but overwritten in TestJob -let ℝ[constexprDim] varVec = [1.0, 1.0]; +let real[constexprDim] varVec = [1.0, 1.0]; // variables needing allocation -ℕ checkDynamicDim; -ℝ[optDim] dynamicVec; +int checkDynamicDim; +real[optDim] dynamicVec; DynamicVecInitialization: { - let ℕ cpt = 0; + let int cpt = 0; // two loops to check the first one is multithread ∀i∈[0;optDim[, dynamicVec[i] = 3.3; ∀i∈[0;optDim[, cpt = cpt + 1; @@ -50,31 +50,31 @@ VarVecInitialization: varVec = [2.2, 2.2]; Oracle: { // options with default values - let ℾ testOptDim = assertEquals(2, optDim); - let ℾ testOptVect1 = assertEquals([1.0, 1.0], optVect1); - let ℾ testOptVect2 = assertEquals([2.0, 2.0], optVect2); - let ℾ testOptVect3 = assertEquals([3.0, 3.0], optVect3); + let bool testOptDim = assertEquals(2, optDim); + let bool testOptVect1 = assertEquals([1.0, 1.0], optVect1); + let bool testOptVect2 = assertEquals([2.0, 2.0], optVect2); + let bool testOptVect3 = assertEquals([3.0, 3.0], optVect3); // const expr var - let ℾ testConstexprDim = assertEquals(2, constexprDim); - let ℾ testConstexprVec = assertEquals([1.1, 1.1], constexprVec); + let bool testConstexprDim = assertEquals(2, constexprDim); + let bool testConstexprVec = assertEquals([1.1, 1.1], constexprVec); // variables with default value but overwritten in InitJob - let ℾ testVarVec = assertEquals([2.2, 2.2], varVec); + let bool testVarVec = assertEquals([2.2, 2.2], varVec); // variables needing allocation - let ℾ testDynamicVecLength = assertEquals(2, checkDynamicDim); + let bool testDynamicVecLength = assertEquals(2, checkDynamicDim); // NOT YET IMPLEMENTED : BaseTypeConstants on a dynamic size - // let ℾ testDynamicVec = assertEquals(dynamicVec, ℝ[optDim](3.3)); + // let bool testDynamicVec = assertEquals(dynamicVec, real[optDim](3.3)); ∀i∈[0;optDim[, - let ℾ testDynamicVec = assertEquals(3.3, dynamicVec[i]); + let bool testDynamicVec = assertEquals(3.3, dynamicVec[i]); // local variables // ∀ r∈nodes(), // { -// let ℕ localNbCells = card(cellsOfNode(r)); -// let ℝ[localNbCells] tmp = ℝ[localNbCells](0.0); -// let ℾ testTmp = assertEquals(tmp, ℝ[localNbCells](0.0)); +// let int localNbCells = card(cellsOfNode(r)); +// let real[localNbCells] tmp = real[localNbCells](0.0); +// let bool testTmp = assertEquals(tmp, real[localNbCells](0.0)); // } } diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ConstExprServicesTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ConstExprServicesTest.xtend index ecfd44fd4..28cc6b9ce 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ConstExprServicesTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ConstExprServicesTest.xtend @@ -45,11 +45,11 @@ class ConstExprServicesTest val model = ''' «testModule» - let ℕ dim = 2; - ℕ unknownDim; - ℝ[2] X{nodes}; - ℝ[1 + 1, unknownDim] Y; - // let ℝ[dim] orig = [0.0, 1.1]; + let int dim = 2; + int unknownDim; + real[2] X{nodes}; + real[1 + 1, unknownDim] Y; + // let real[dim] orig = [0.0, 1.1]; ''' val rs = resourceSetProvider.get @@ -89,16 +89,16 @@ class ConstExprServicesTest val model = ''' «emptyTestModule» - def f: x,y | ℝ[x] × ℝ[y] → ℝ[x+y], (a, b) → + def f: x,y | real[x] × real[y] → real[x+y], (a, b) → { - let ℝ[x+y] c = 2.0; + let real[x+y] c = 2.0; c = a * 2.0; return c + 4.0; } - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; - ℝ[4, 2] m; + real[4] n; + real[4, 2] m; ∀ i∈[0;4[, { n[i] = 4.0; diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/DeclarationProviderTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/DeclarationProviderTest.xtend index da2a5c4d8..41e65605f 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/DeclarationProviderTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/DeclarationProviderTest.xtend @@ -54,16 +54,16 @@ class DeclarationProviderTest ''' extension MyLibOfFunctions; - def f: → ℕ; - def f: ℕ → ℕ; - def f: ℝ → ℝ; - def f: ℝ[2] → ℝ[2]; + def f: → int; + def f: int → int; + def f: real → real; + def f: real[2] → real[2]; - def g: a | ℝ[a] → ℝ[a]; - def g: a, b | ℝ[a, b] → ℝ[a*b]; - def g: a, b | ℝ[a] × ℝ[b] → ℝ[a+b]; + def g: a | real[a] → real[a]; + def g: a, b | real[a, b] → real[a*b]; + def g: a, b | real[a] × real[b] → real[a+b]; - def h: a | ℝ[a] × ℝ[a] → ℝ[a]; + def h: a | real[a] × real[a] → real[a]; ''' val nablaModel = @@ -73,47 +73,47 @@ class DeclarationProviderTest with MyLibOfFunctions.*; with CartesianMesh2D.*; - ℝ[card(cells())] a; - ℝ x{cells}; - ℝ[2] x2{cells}; - ℝ[3] t; + real[card(cells())] a; + real x{cells}; + real[2] x2{cells}; + real[3] t; - let ℕ constexprDim = 2; - let ℝ[constexprDim] constexprVec = [1.1, 1.1]; + let int constexprDim = 2; + let real[constexprDim] constexprVec = [1.1, 1.1]; // --- TEST DE F --- - J0: { let ℕ y = f(); } - J1: { let ℕ y = f(2); } - J2: { let ℝ y = f(3.0); } + J0: { let int y = f(); } + J1: { let int y = f(2); } + J2: { let real y = f(3.0); } J3: { - let ℝ[2] b = [1.1, 2.2]; - let ℝ[2] y = f(b); + let real[2] b = [1.1, 2.2]; + let real[2] y = f(b); y = f(constexprVec); } - J4: { let ℝ y = f(3.0, true); } // Wrong arguments : ℝ, ℾ + J4: { let real y = f(3.0, true); } // Wrong arguments : real, bool // --- TEST DE G --- J5: { - let ℝ[2] b = [1.1, 2.2]; - let ℝ[2] y = g(b); + let real[2] b = [1.1, 2.2]; + let real[2] y = g(b); } J6: { - let ℝ[2,3] b = [[1.1, 2.2, 3.3], [4.4, 5.5, 6.6]]; - let ℝ[6] y = g(b); + let real[2,3] b = [[1.1, 2.2, 3.3], [4.4, 5.5, 6.6]]; + let real[6] y = g(b); } J7: { - let ℝ[2] b = [1.1, 2.2]; - let ℝ[3] c = [3.3, 4.4, 5.5]; - let ℝ[5] y = g(b, c); + let real[2] b = [1.1, 2.2]; + let real[3] c = [3.3, 4.4, 5.5]; + let real[5] y = g(b, c); } - J8: { let ℝ[3] gt = g(t); } - J9: { a = g(x, x); } // Wrong arguments : ℝ{cells}, ℝ{cells} - J10: { a = g(x2); } // Wrong arguments : ℝ²{cells} + J8: { let real[3] gt = g(t); } + J9: { a = g(x, x); } // Wrong arguments : real{cells}, real{cells} + J10: { a = g(x2); } // Wrong arguments : real²{cells} // --- TEST DE H --- J11: { - let ℝ[2] b = [1.1, 2.2]; - let ℝ[2] y = h(b, constexprVec); + let real[2] b = [1.1, 2.2]; + let real[2] y = h(b, constexprVec); } ''' @@ -177,20 +177,20 @@ class DeclarationProviderTest ''' extension Test; - def f: ℝ → ℝ, (a) → return a; - def f: ℝ[2] → ℝ[2], (a) → return a; - def g: x | ℝ[x] → ℝ[x], (a) → return a; + def f: real → real, (a) → return a; + def f: real[2] → real[2], (a) → return a; + def g: x | real[x] → real[x], (a) → return a; - def h: ℝ[2] → ℝ[2], (a) → { + def h: real[2] → real[2], (a) → { return f(a) + g(a); } - def i: a | ℝ[a] → ℝ[a], (x) → { - return f(x); // Wrong f only on ℝ[2] + def i: a | real[a] → real[a], (x) → { + return f(x); // Wrong f only on real[2] } - def j: a | ℝ[a] → ℝ[a], (x) → { - let ℝ[a] y = g(x); + def j: a | real[a] → real[a], (x) → { + let real[a] y = g(x); ∀i∈[0;a[, y[i] = f(x[i]); return y; } @@ -199,7 +199,7 @@ class DeclarationProviderTest val ext = parseHelper.parse(model) as DefaultExtension Assert.assertNotNull(ext) Assert.assertEquals(1, ext.validate.filter(i | i.severity == Severity.ERROR).size) - ext.assertError(NablaPackage.eINSTANCE.functionCall, ExpressionValidator::FUNCTION_CALL_ARGS, ExpressionValidator::getFunctionCallArgsMsg(#["ℝ[a]"])) + ext.assertError(NablaPackage.eINSTANCE.functionCall, ExpressionValidator::FUNCTION_CALL_ARGS, ExpressionValidator::getFunctionCallArgsMsg(#["real[a]"])) val functions = ext.functions val h = functions.findFirst[name == 'h'] @@ -224,17 +224,17 @@ class DeclarationProviderTest with CartesianMesh2D.*; - def f, 0.0: ℝ, (a , b) → return a; - def f, 0.0: x | ℝ[x], (a , b) → return a; + def f, 0.0: real, (a , b) → return a; + def f, 0.0: x | real[x], (a , b) → return a; - ℝ u{cells}; - ℝ[2] u2{cells}; - ℕ bidon{cells}; + real u{cells}; + real[2] u2{cells}; + int bidon{cells}; // --- TEST DE F --- - J0: { let ℝ x = f{j ∈ cells()}(u{j}); } - J1: { let ℝ[2] x = f{j ∈ cells()}(u2{j}); } - J2: { let ℝ x = f{j ∈ cells()}(bidon{j}); } // Wrong arguments : ℕ + J0: { let real x = f{j ∈ cells()}(u{j}); } + J1: { let real[2] x = f{j ∈ cells()}(u2{j}); } + J2: { let real x = f{j ∈ cells()}(bidon{j}); } // Wrong arguments : int ''' val rs = resourceSetProvider.get diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/IteratorExtensionsTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/IteratorExtensionsTest.xtend index 0243fda8e..2e41efd93 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/IteratorExtensionsTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/IteratorExtensionsTest.xtend @@ -55,23 +55,23 @@ class IteratorExtensionsTest with CartesianMesh2D.*; - def ∑, 0.0: ℝ, (a, b) → return a + b; - def ∑, 0.0: x | ℝ[x], (a, b) → return a + b; - def ∑, 0.0: x | ℝ[x, x], (a, b) → return a + b; + def ∑, 0.0: real, (a, b) → return a + b; + def ∑, 0.0: x | real[x], (a, b) → return a + b; + def ∑, 0.0: x | real[x, x], (a, b) → return a + b; «simulationVariables» - ℝ x{cells}, f{cells}, Cjr{cells,nodesOfCell}; - ℝ[2] X{nodes}, u{cells}; - ℝ surface{faces}; - ℝ a; + real x{cells}, f{cells}, Cjr{cells,nodesOfCell}; + real[2] X{nodes}, u{cells}; + real surface{faces}; + real a; J1: ∀j∈cells(), x{j} = 2.0; J2: ∀j∈cells(), ∀r∈nodesOfCell(j), Cjr{j,r} = 3.0; J3: ∀r∈nodes(), ∀j∈cellsOfNode(r), Cjr{j,r} = 1.0; J4: ∀j∈cells(), u{j} = 0.5 * ∑{r∈nodesOfCell(j)}(X{r} - X{r+1}); J5: ∀j1∈cells(), f{j1} = a * ∑{j2∈neighbourCells(j1)}(∑{cf∈commonFace(j1,j2)}((x{j2}-x{j1}) / surface{cf})); - J6: ∀j1∈cells(), ∀j2∈neighbourCells(j1), ∀cf∈commonFace(j1,j2), let ℝ bidon = (x{j2}-x{j1}) / surface{cf}); + J6: ∀j1∈cells(), ∀j2∈neighbourCells(j1), ∀cf∈commonFace(j1,j2), let real bidon = (x{j2}-x{j1}) / surface{cf}); ''' val rs = resourceSetProvider.get diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablaScopeProviderTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablaScopeProviderTest.xtend index d014e11d7..97cb7f100 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablaScopeProviderTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablaScopeProviderTest.xtend @@ -49,14 +49,14 @@ class NablaScopeProviderTest ''' «testModule» - ℝ a{cells}, b{cells, nodesOfCell}, c{cells}; - ℝ d{nodes}; + real a{cells}, b{cells, nodesOfCell}, c{cells}; + real d{nodes}; j1 : ∀j ∈ cells(), a{j} = 0.0; j2 : ∀j ∈ cells(), c{j} = 0.25 * ∑{r ∈ nodes()}(d{r}); j3 : ∀j ∈ cells(), ∀r ∈ nodesOfCell(j), b{j,r} = 0.; j4 : ∀j ∈ cells(), a{j} = ∑{r∈nodesOfCell(j)}(b{j, r}); - j5 : let ℝ z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(X{r})); + j5 : let real z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(X{r})); j6 : ∀j ∈ cells(), ∀ rj ∈ rightCell(j), ∀ lj ∈ leftCell(j), c{j} = a{rj}; j7 : ∀j ∈ cells(), { set rjset = rightCell(j); @@ -110,8 +110,8 @@ class NablaScopeProviderTest val model = ''' «testModule» - ℝ a{cells}, b{cells, nodesOfCell}, c{cells}; - ℝ d{nodes}; + real a{cells}, b{cells, nodesOfCell}, c{cells}; + real d{nodes}; j1 : ∀j ∈ cells(), a{j} = 0.0; j2 : ∀j ∈ cells(), c{j} = 0.25 * ∑{r ∈ nodes()}(d{r}); @@ -198,7 +198,7 @@ class NablaScopeProviderTest val model = ''' «testModule» - ℝ a{cells}, b{cells, nodesOfCell}; + real a{cells}, b{cells, nodesOfCell}; j1 : ∀j ∈ cells(), a{j} = 0.0; j2 : { @@ -235,28 +235,28 @@ class NablaScopeProviderTest val model = ''' «testModule» - let ℝ a = 4.0; - let ℝ b1 = 0.0; - let ℝ b2 = b1; - ℝ[2] X{nodes}; - ℝ c1 {cells}, c2 {cells}; + let real a = 4.0; + let real b1 = 0.0; + let real b2 = b1; + real[2] X{nodes}; + real c1 {cells}, c2 {cells}; iterate n while (n > 4), k while (n > 4 && k < 2); j1: ∀ j∈cells(), { c1{j} = a * 2; - let ℝ d = 6.0; + let real d = 6.0; c2{j} = 2 * d; ∀ r, countr ∈ nodesOfCell(j), { - let ℝ e = 3.3; - ℝ f; + let real e = 3.3; + real f; f = e + 1.0; } } j2: { - ℝ[4] o; - ℝ[4, 2] p; + real[4] o; + real[4, 2] p; ∀ i∈[0;4[, { o[i] = 4.0; @@ -265,7 +265,7 @@ class NablaScopeProviderTest } j3: { - let ℝ z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(∑{i∈[0;2[}(X{r}[i]))); + let real z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(∑{i∈[0;2[}(X{r}[i]))); z = z + 1; } ''' @@ -321,7 +321,7 @@ class NablaScopeProviderTest val model = ''' «emptyTestModule» - def reduceMin, ℝ.MaxValue: ℝ, (a, b) → return min(a, b); + def reduceMin, real.MaxValue: real, (a, b) → return min(a, b); ''' val module = parseHelper.parse(model) Assert.assertNotNull(module) @@ -339,16 +339,16 @@ class NablaScopeProviderTest val model = ''' «emptyTestModule» - def f: x,y | ℝ[x] × ℝ[y] → ℝ[x+y], (a, b) → + def f: x,y | real[x] × real[y] → real[x+y], (a, b) → { - let ℝ c = 2.0; + let real c = 2.0; c = a * 2.0; return c + 4.0; } - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; - ℝ[4, 2] m; + real[4] n; + real[4, 2] m; ∀ i∈[0;4[, { n[i] = 4.0; @@ -389,16 +389,16 @@ class NablaScopeProviderTest val model = ''' «testModule» - ℝ[2] X{nodes}; - ℝ c1 {cells}; + real[2] X{nodes}; + real c1 {cells}; j1: ∀ j∈cells(), { c1{j} = 2.0; } j2: { - ℝ[4] n; - ℝ[4, 2] m; + real[4] n; + real[4, 2] m; ∀ i∈[0;4[, { n[i] = 4.0; @@ -407,7 +407,7 @@ class NablaScopeProviderTest } j3: { - let ℝ z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(∑{k∈[0;1[}(X{r}[k+1]))); + let real z = ∑{j∈cells()}(∑{r∈nodesOfCell(j)}(∑{k∈[0;1[}(X{r}[k+1]))); z = z + 1; } ''' @@ -448,15 +448,15 @@ class NablaScopeProviderTest val model = ''' «emptyTestModule» - def f: x,y | ℝ[x] × ℝ[y] → ℝ[x+y], (a, b) → + def f: x,y | real[x] × real[y] → real[x+y], (a, b) → { - ℝ[x,y] c; + real[x,y] c; return c; } - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; - ℝ[4, 2] m; + real[4] n; + real[4, 2] m; ∀ i∈[0;4[, { n[i] = 4.0; diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablagenScopeProviderTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablagenScopeProviderTest.xtend index cd6519660..204723c64 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablagenScopeProviderTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/NablagenScopeProviderTest.xtend @@ -45,13 +45,13 @@ class NablagenScopeProviderTest with CartesianMesh2D.*; // Simulation options - ℝ maxTime; - ℕ maxIter; + real maxTime; + int maxIter; - let ℝ t = 0.0; - let ℝ δt = 1.0; - ℝ[2] X{nodes}; - ℝ hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; + let real t = 0.0; + let real δt = 1.0; + real[2] X{nodes}; + real hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; iterate n while (n+1 < maxIter && t^{n+1} < maxTime); @@ -66,8 +66,8 @@ class NablagenScopeProviderTest with CartesianMesh2D.*; - ℝ[2] X{nodes}; - ℝ rv1{cells}, rv2{cells}, rv3{cells}; + real[2] X{nodes}; + real rv1{cells}, rv2{cells}, rv3{cells}; rj1: ∀c∈cells(), rv2{c} = rv1{c}; rj2: ∀c∈cells(), rv3{c} = rv2{c}; diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/TestUtils.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/TestUtils.xtend index 3c9d88e62..237e6b0cb 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/TestUtils.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/TestUtils.xtend @@ -84,8 +84,8 @@ class TestUtils def getSimulationVariables() ''' - let ℝ δt = 0.001; - ℝ t; + let real δt = 0.001; + real t; ''' def getEmptyTestModule() diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractBinaryOperationsInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractBinaryOperationsInterpreterTest.xtend index 9eedb5b20..958bdec3f 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractBinaryOperationsInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractBinaryOperationsInterpreterTest.xtend @@ -29,22 +29,22 @@ abstract class AbstractBinaryOperationsInterpreterTest val model = ''' «testModule» - let ℾ b1 = true || false; // -> true - let ℾ b2 = true || true; // -> true - let ℾ b3 = false || false; // -> false - - let ℾ b4 = true && false; // -> false - let ℾ b5 = true && true; // -> true - let ℾ b6 = false && false; // -> false - - let ℾ b7 = true == false; // -> false - let ℾ b8 = true != false; // -> true - let ℾ b9 = true >= false; // -> true - let ℾ b10 = true <= false; // -> false - let ℾ b11 = true > false; // -> true - let ℾ b12 = true < false; // -> false - - ℝ[2] X{nodes}; + let bool b1 = true || false; // -> true + let bool b2 = true || true; // -> true + let bool b3 = false || false; // -> false + + let bool b4 = true && false; // -> false + let bool b5 = true && true; // -> true + let bool b6 = false && false; // -> false + + let bool b7 = true == false; // -> false + let bool b8 = true != false; // -> true + let bool b9 = true >= false; // -> true + let bool b10 = true <= false; // -> false + let bool b11 = true > false; // -> true + let bool b12 = true < false; // -> false + + real[2] X{nodes}; ''' assertGetValueOfNV0Bool_NV0Bool(model) } @@ -55,32 +55,32 @@ abstract class AbstractBinaryOperationsInterpreterTest val model = ''' «testModule» - let ℾ b1 = 1 == 2; // -> false - let ℾ b2 = 1 == 1; // -> true + let bool b1 = 1 == 2; // -> false + let bool b2 = 1 == 1; // -> true - let ℾ b3 = 1 != 2; // -> true - let ℾ b4 = 2 != 2; // -> false + let bool b3 = 1 != 2; // -> true + let bool b4 = 2 != 2; // -> false - let ℾ b5 = 1 >= 2; // -> false - let ℾ b6 = 2 >= 2; // -> true + let bool b5 = 1 >= 2; // -> false + let bool b6 = 2 >= 2; // -> true - let ℾ b7 = 1 <= 2; // -> true - let ℾ b8 = 2 <= 2; // -> true + let bool b7 = 1 <= 2; // -> true + let bool b8 = 2 <= 2; // -> true - let ℾ b9 = 1 > 2; // -> false - let ℾ b10 = 2 > 1; // -> true + let bool b9 = 1 > 2; // -> false + let bool b10 = 2 > 1; // -> true - let ℾ b11 = 1 < 2; // -> true - let ℾ b12 = 2 < 1; // -> false + let bool b11 = 1 < 2; // -> true + let bool b12 = 2 < 1; // -> false - let ℕ n1 = 1 + 2; // -> 3 - let ℕ n2 = 2 - 1; // -> 1 - let ℕ n3 = 2 * 3; // -> 6 - let ℕ n4 = 6 / 3; // -> 2 - let ℕ n5 = 7 / 3; // -> 2 - let ℕ n6 = 7 % 3; // -> 1 + let int n1 = 1 + 2; // -> 3 + let int n2 = 2 - 1; // -> 1 + let int n3 = 2 * 3; // -> 6 + let int n4 = 6 / 3; // -> 2 + let int n5 = 7 / 3; // -> 2 + let int n6 = 7 % 3; // -> 1 - ℝ[2] X{nodes}; + real[2] X{nodes}; ''' assertGetValueOfNV0Int_NV0Int(model) } @@ -91,31 +91,31 @@ abstract class AbstractBinaryOperationsInterpreterTest val model = ''' «testModule» - let ℾ b1 = 1 == 2.; // -> false - let ℾ b2 = 1 == 1; // -> true + let bool b1 = 1 == 2.; // -> false + let bool b2 = 1 == 1; // -> true - let ℾ b3 = 1 != 2.; // -> true - let ℾ b4 = 2 != 2.; // -> false + let bool b3 = 1 != 2.; // -> true + let bool b4 = 2 != 2.; // -> false - let ℾ b5 = 1 >= 2.; // -> false - let ℾ b6 = 2 >= 2.; // -> true + let bool b5 = 1 >= 2.; // -> false + let bool b6 = 2 >= 2.; // -> true - let ℾ b7 = 1 <= 2.; // -> true - let ℾ b8 = 2 <= 2.; // -> true + let bool b7 = 1 <= 2.; // -> true + let bool b8 = 2 <= 2.; // -> true - let ℾ b9 = 1 > 2.; // -> false - let ℾ b10 = 2 > 1.; // -> true + let bool b9 = 1 > 2.; // -> false + let bool b10 = 2 > 1.; // -> true - let ℾ b11 = 1 < 2.; // -> true - let ℾ b12 = 2 < 1.; // -> false + let bool b11 = 1 < 2.; // -> true + let bool b12 = 2 < 1.; // -> false - let ℝ n1 = 1 + 2.; // -> 3. - let ℝ n2 = 2 - 1.; // -> 1. - let ℝ n3 = 2 * 3.; // -> 6. - let ℝ n4 = 6 / 3.; // -> 2. - let ℝ n5 = 7 / 2.; // -> 3.5. + let real n1 = 1 + 2.; // -> 3. + let real n2 = 2 - 1.; // -> 1. + let real n3 = 2 * 3.; // -> 6. + let real n4 = 6 / 3.; // -> 2. + let real n5 = 7 / 2.; // -> 3.5. - ℝ[2] X{nodes}; + real[2] X{nodes}; ''' assertGetValueOfNV0Int_NV0Real(model) } @@ -126,11 +126,11 @@ abstract class AbstractBinaryOperationsInterpreterTest val model = ''' «testModule» - let ℕ[2] n1 = [1,2]; - let ℕ[2] n2 = 3 + n1; - let ℕ[2] n3 = 3 * n1; + let int[2] n1 = [1,2]; + let int[2] n2 = 3 + n1; + let int[2] n3 = 3 * n1; - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractExpressionInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractExpressionInterpreterTest.xtend index de055ca3c..32093fa3f 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractExpressionInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractExpressionInterpreterTest.xtend @@ -29,10 +29,10 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℝ r1 = true ? 1.0 : 2.0; // -> 1.0 - let ℝ r2 = false ? 1.0 : 2.0; // -> 1.0 + let real r1 = true ? 1.0 : 2.0; // -> 1.0 + let real r2 = false ? 1.0 : 2.0; // -> 1.0 - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -45,19 +45,19 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℾ b0 = !false; // -> true - let ℕ n0 = -(1); // -> -1 - let ℝ r0 = -(1.); // -> -1. - let ℕ[2] n1 = [1, 2]; - let ℕ[2] n2 = -n1; // -> [-1, -2] - let ℝ[2] r1 = [1., 2.]; - let ℝ[2] r2 = -r1; // -> [-1., -2] - let ℕ[2,2] n3 = [[0, 1],[1, 2]]; - let ℕ[2,2] n4 = -n3; // -> [[0, -1],[-1, -2]] - let ℝ[2,2] r3 = [[0., 1.],[1., 2.]]; - let ℝ[2,2] r4 = -r3; // -> [[-0., -1.],[-1., -2.]]*/ - - ℝ[2] X{nodes}; + let bool b0 = !false; // -> true + let int n0 = -(1); // -> -1 + let real r0 = -(1.); // -> -1. + let int[2] n1 = [1, 2]; + let int[2] n2 = -n1; // -> [-1, -2] + let real[2] r1 = [1., 2.]; + let real[2] r2 = -r1; // -> [-1., -2] + let int[2,2] n3 = [[0, 1],[1, 2]]; + let int[2,2] n4 = -n3; // -> [[0, -1],[-1, -2]] + let real[2,2] r3 = [[0., 1.],[1., 2.]]; + let real[2,2] r4 = -r3; // -> [[-0., -1.],[-1., -2.]]*/ + + real[2] X{nodes}; InitT: t=0.0; ''' @@ -70,8 +70,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℾ b = (true); - ℝ[2] X{nodes}; + let bool b = (true); + real[2] X{nodes}; InitT: t=0.0; ''' @@ -85,12 +85,12 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ n1 = 1; - let ℝ r1 = 2.0; - let ℾ b1 = true; - let ℾ b2 = false; + let int n1 = 1; + let real r1 = 2.0; + let bool b1 = true; + let bool b2 = false; - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -103,10 +103,10 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ nMin = ℕ.MinValue; - let ℝ rMin = ℝ.MinValue; + let int nMin = int.MinValue; + let real rMin = real.MinValue; - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -119,10 +119,10 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ nMax = ℕ.MaxValue; - let ℝ rMax = ℝ.MaxValue; + let int nMax = int.MaxValue; + let real rMax = real.MaxValue; - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -135,19 +135,19 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ n1 = ℕ(1); - let ℕ[2] n2 = ℕ[2](1); - let ℕ[2,3] n3 = ℕ[2,3](1); + let int n1 = int(1); + let int[2] n2 = int[2](1); + let int[2,3] n3 = int[2,3](1); - let ℝ r1 = ℝ(1.); - let ℝ[2] r2 = ℝ[2](1.); - let ℝ[2,3] r3 = ℝ[2,3](1.); + let real r1 = real(1.); + let real[2] r2 = real[2](1.); + let real[2,3] r3 = real[2,3](1.); - let ℾ b1 = ℾ(true); - let ℾ[2] b2 = ℾ[2](true); - let ℾ[2,3] b3 = ℾ[2,3](true); + let bool b1 = bool(true); + let bool[2] b2 = bool[2](true); + let bool[2,3] b3 = bool[2,3](true); - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -160,8 +160,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ[2] n = [1, 2]; - ℝ[2] X{nodes}; + let int[2] n = [1, 2]; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -174,8 +174,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℕ[2,3] n = [[0, 1, 2],[1, 2, 3]]; - ℝ[2] X{nodes}; + let int[2,3] n = [[0, 1, 2],[1, 2, 3]]; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -188,8 +188,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℝ[2] r = [1.0, 2.0]; - ℝ[2] X{nodes}; + let real[2] r = [1.0, 2.0]; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -202,8 +202,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℝ[2,3] r = [[0., 1., 2.],[1., 2., 3.]]; - ℝ[2] X{nodes}; + let real[2,3] r = [[0., 1., 2.],[1., 2., 3.]]; + real[2] X{nodes}; InitT: t=0.0; ''' @@ -216,8 +216,8 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - ℕ c; - ℝ[2] X{nodes}; + int c; + real[2] X{nodes}; InitT: t=0.0; Job1: c = card(nodes()); @@ -233,39 +233,39 @@ abstract class AbstractExpressionInterpreterTest «emptyTestModule» with CartesianMesh2D.*; - def getOne: → ℕ, () → return 1; - def addOne: ℕ → ℕ, (a) → return a + 1; - def addOne: ℝ → ℝ, (a) → return a + 1.0; - def add: ℕ × ℕ → ℕ, (a, b) → return a + b; - def add: ℝ × ℕ → ℝ, (a, b) → return a + b; - def add: ℝ × ℝ → ℝ, (a, b) → return a + b; - def add: x | ℝ[x] × ℝ[x] → ℝ[x], (a, b) → return a + b; - def add: x,y | ℝ[x,y] × ℝ[x,y] → ℝ[x,y], (a, b) → return a + b; + def getOne: → int, () → return 1; + def addOne: int → int, (a) → return a + 1; + def addOne: real → real, (a) → return a + 1.0; + def add: int × int → int, (a, b) → return a + b; + def add: real × int → real, (a, b) → return a + b; + def add: real × real → real, (a, b) → return a + b; + def add: x | real[x] × real[x] → real[x], (a, b) → return a + b; + def add: x,y | real[x,y] × real[x,y] → real[x,y], (a, b) → return a + b; «simulationVariables» - let ℕ n0 = 0; - let ℕ n1 = getOne(); //-> 1 - let ℕ n2 = addOne(n1); //-> 2 - let ℕ n3 = add(n1, n2); //-> 3 - let ℝ r0 = 0. ; - let ℝ r1 = addOne(r0); //-> 1. - let ℝ r2 = add(r1, n1); //-> 2. - let ℝ r3 = add(r2, r1); //-> 3. - - let ℝ[2] u = ℝ[2](1.); - let ℝ[2] v = ℝ[2](2.); - let ℝ[2] w = add(u,v); //-> [3., 3.] - - let ℝ[3] α = ℝ[3](1.); - let ℝ[3] β = ℝ[3](2.); - let ℝ[3] res1 = add(α,β); //-> [3., 3., 3.] - - let ℝ[2,2] δ = ℝ[2,2](1.); - let ℝ[2,2] ρ = ℝ[2,2](2.); - let ℝ[2,2] res2 = add(δ,ρ); //-> [3., 3][3., 3.] - - let ℝ[3] res3 = add(res1 + α, β); //-> [6., 6., 6.] - ℝ[2] X{nodes}; + let int n0 = 0; + let int n1 = getOne(); //-> 1 + let int n2 = addOne(n1); //-> 2 + let int n3 = add(n1, n2); //-> 3 + let real r0 = 0. ; + let real r1 = addOne(r0); //-> 1. + let real r2 = add(r1, n1); //-> 2. + let real r3 = add(r2, r1); //-> 3. + + let real[2] u = real[2](1.); + let real[2] v = real[2](2.); + let real[2] w = add(u,v); //-> [3., 3.] + + let real[3] α = real[3](1.); + let real[3] β = real[3](2.); + let real[3] res1 = add(α,β); //-> [3., 3., 3.] + + let real[2,2] δ = real[2,2](1.); + let real[2,2] ρ = real[2,2](2.); + let real[2,2] res2 = add(δ,ρ); //-> [3., 3][3., 3.] + + let real[3] res3 = add(res1 + α, β); //-> [6., 6., 6.] + real[2] X{nodes}; InitT: t=0.0; ''' @@ -281,30 +281,30 @@ abstract class AbstractExpressionInterpreterTest with CartesianMesh2D.*; - def h: ℝ[2] → ℝ[2], (a) → return 2 * a; + def h: real[2] → real[2], (a) → return 2 * a; - def i: a | ℝ[a] → ℝ[a], (x) → { + def i: a | real[a] → real[a], (x) → { return 2 * x; } - def j: a | ℝ[a] → ℝ[a], (x) → { - ℝ[a] y; + def j: a | real[a] → real[a], (x) → { + real[a] y; ∀i∈[0;a[, y[i] = 2 * x[i]; return y; } - def k: b | ℝ[b] → ℝ[b], (x) → return j(x); + def k: b | real[b] → real[b], (x) → return j(x); «simulationVariables» - let ℝ[2] u = [0.0, 0.1]; - let ℝ[3] v = [0.0, 0.1, 0.2]; - ℝ[2] w1; - ℝ[2] w2; - ℝ[3] w3; - ℝ[2] w4; - ℝ[3] w5; - ℝ[2] w6; - ℝ[2] X{nodes}; + let real[2] u = [0.0, 0.1]; + let real[3] v = [0.0, 0.1, 0.2]; + real[2] w1; + real[2] w2; + real[3] w3; + real[2] w4; + real[3] w5; + real[2] w6; + real[2] X{nodes}; J1: w1 = h(u); J2: w2 = i(u); @@ -324,28 +324,28 @@ abstract class AbstractExpressionInterpreterTest val model = ''' «testModule» - let ℾ b1 = true; - let ℾ b2 = b1; // -> true - - let ℕ n1 = 1; - let ℕ n2 = n1; // -> 1 - let ℕ[2] n3 = [2,3]; - let ℕ[2] n4 = n3; // -> [2,3] - let ℕ n5 = n3[0]; // -> 2 - let ℕ[3,2] n6 = [[2,3],[4,5],[6,7]]; - let ℕ[3,2] n7 = n6; // -> [[2,3],[4,5],[6,7]] - let ℕ n8 = n6[1,1]; // -> 5 - - let ℝ r1 = 1.; - let ℝ r2 = r1; // -> 1. - let ℝ[2] r3 = [2.,3.]; - let ℝ[2] r4 = r3; // -> [2.,3.] - let ℝ r5 = r3[0]; // -> 2. - let ℝ[3,2] r6 = [[2.,3.],[4.,5.],[6.,7.]]; - let ℝ[3,2] r7 = r6; // -> [[2.,3.],[4.,5.],[6.,7.]] - let ℝ r8 = r6[1,1]; // -> 5. - - ℝ[2] X{nodes}; + let bool b1 = true; + let bool b2 = b1; // -> true + + let int n1 = 1; + let int n2 = n1; // -> 1 + let int[2] n3 = [2,3]; + let int[2] n4 = n3; // -> [2,3] + let int n5 = n3[0]; // -> 2 + let int[3,2] n6 = [[2,3],[4,5],[6,7]]; + let int[3,2] n7 = n6; // -> [[2,3],[4,5],[6,7]] + let int n8 = n6[1,1]; // -> 5 + + let real r1 = 1.; + let real r2 = r1; // -> 1. + let real[2] r3 = [2.,3.]; + let real[2] r4 = r3; // -> [2.,3.] + let real r5 = r3[0]; // -> 2. + let real[3,2] r6 = [[2.,3.],[4.,5.],[6.,7.]]; + let real[3,2] r7 = r6; // -> [[2.,3.],[4.,5.],[6.,7.]] + let real r8 = r6[1,1]; // -> 5. + + real[2] X{nodes}; InitT: t=0.0; ''' diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractInstructionInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractInstructionInterpreterTest.xtend index 80e601212..ee0e79c15 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractInstructionInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractInstructionInterpreterTest.xtend @@ -29,8 +29,8 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - ℝ[2] X{nodes}; - Job1: { let ℝ r = 1.0; t = r; } + real[2] X{nodes}; + Job1: { let real r = 1.0; t = r; } ''' assertInterpreteVarDefinition(model) } @@ -41,8 +41,8 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - ℝ[2] X{nodes}; - Job1: { let ℝ r = 1.0; t = r; } + real[2] X{nodes}; + Job1: { let real r = 1.0; t = r; } ''' assertInterpreteInstructionBlock(model) } @@ -53,8 +53,8 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - ℝ[2] X{nodes}; - Job1: { let ℝ r = 1.0; t = r; } + real[2] X{nodes}; + Job1: { let real r = 1.0; t = r; } ''' assertInterpreteAffectation(model) } @@ -65,13 +65,13 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - let ℕ maxIter = 10; - let ℝ maxTime = 1.0; - ℝ U{cells}; - ℝ[2] X{nodes}, B{nodes}, C{cells, nodesOfCell}; - ℝ Bmin, Bmax; - let ℕ size = 4; - ℝ[size] tab; + let int maxIter = 10; + let real maxTime = 1.0; + real U{cells}; + real[2] X{nodes}, B{nodes}, C{cells, nodesOfCell}; + real Bmin, Bmax; + let int size = 4; + real[size] tab; iterate n while (n+1 < maxIter && t^{n+1} < maxTime); @@ -79,8 +79,8 @@ abstract class AbstractInstructionInterpreterTest InitU : ∀r∈cells(), U{r} = 1.0; ComputeCjr: ∀j∈ cells(), { set rCellsJ = nodesOfCell(j); - let ℕ cardRCellsJ = card(rCellsJ); - ℝ[cardRCellsJ] tmp; + let int cardRCellsJ = card(rCellsJ); + real[cardRCellsJ] tmp; ∀r, countr ∈ rCellsJ, { tmp[countr] = 0.5; // stupid but test countr C{j,r} = tmp[countr] * (X{r+1} - X{r-1}); @@ -114,8 +114,8 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - ℝ U{cells}; - ℝ[2] X{nodes}; + real U{cells}; + real[2] X{nodes}; InitT: t=0.0; InitU : ∀r, countr ∈ cells(), { @@ -134,12 +134,12 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - ℝ U{cells}; - ℝ[2] X{nodes}, C{cells, nodesOfCell}; + real U{cells}; + real[2] X{nodes}, C{cells, nodesOfCell}; InitT: t=0.0; InitU : { - let ℕ i = 0; + let int i = 0; while (i<3) { ∀r ∈ cells(), U{r} = 1.0 * i; i = i +1; @@ -156,8 +156,8 @@ abstract class AbstractInstructionInterpreterTest ''' «testModule» - ℝ[2] X{nodes}; - ℝ U{cells}; + real[2] X{nodes}; + real U{cells}; InitT: t=0.0; InitU : { @@ -174,9 +174,9 @@ abstract class AbstractInstructionInterpreterTest val model = ''' «testModule» - let ℕ V=100; - let ℕ W=0; - ℝ[2] X{nodes}; + let int V=100; + let int W=0; + real[2] X{nodes}; InitT: t=0.0; Test : if (V < 100) W = V+1; else exit "V must be less than 100"; diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractJobInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractJobInterpreterTest.xtend index d7af2c940..a90882975 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractJobInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractJobInterpreterTest.xtend @@ -29,7 +29,7 @@ abstract class AbstractJobInterpreterTest val model = ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; InitT : t = 5.; ''' assertInterpreteInstructionJob(model) @@ -42,9 +42,9 @@ abstract class AbstractJobInterpreterTest ''' «testModule» // Simulation options - let ℝ option_stoptime = 0.2; - let ℕ option_max_iterations = 10; - ℝ[2] X{nodes}; + let real option_stoptime = 0.2; + let int option_max_iterations = 10; + real[2] X{nodes}; iterate n while (t^{n+1} < option_stoptime && n < option_max_iterations); @@ -61,10 +61,10 @@ abstract class AbstractJobInterpreterTest ''' «testModule» // Simulation options - let ℝ option_stoptime = 0.2; - let ℕ option_max_iterations = 10; - ℝ u; - ℝ[2] X{nodes}, center{cells}; + let real option_stoptime = 0.2; + let int option_max_iterations = 10; + real u; + real[2] X{nodes}, center{cells}; iterate n while (t^{n+1} < option_stoptime && n < option_max_iterations); diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractModuleInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractModuleInterpreterTest.xtend index a63f97438..cb37a76d4 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractModuleInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractModuleInterpreterTest.xtend @@ -30,9 +30,9 @@ abstract class AbstractModuleInterpreterTest ''' «testModule» // Simulation options - let ℝ option_stoptime = 0.2; - let ℕ option_max_iterations = 20000; - ℝ[2] X{nodes}; + let real option_stoptime = 0.2; + let int option_max_iterations = 20000; + real[2] X{nodes}; iterate n while (t^{n+1} < option_stoptime && n < option_max_iterations); diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractOptionsInterpreterTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractOptionsInterpreterTest.xtend index 9599bc908..a3854e5f7 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractOptionsInterpreterTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/interpreter/AbstractOptionsInterpreterTest.xtend @@ -25,20 +25,20 @@ abstract class AbstractOptionsInterpreterTest with CartesianMesh2D.*; - ℕ A; - let ℕ B = A / 2 + 4; - ℝ C; - ℝ[3] D; - ℝ[2, 3] M; + int A; + let int B = A / 2 + 4; + real C; + real[3] D; + real[2, 3] M; - ℕ max_time_iterations; - ℝ final_time; + int max_time_iterations; + real final_time; - let ℝ t = 0.0; - let ℝ δt = 0.001; + let real t = 0.0; + let real δt = 0.001; - ℝ[2] X{nodes}; - J: let ℝ s = 3.33; + real[2] X{nodes}; + J: let real s = 3.33; ''' @Test diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/CreateArrayOperatorsTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/CreateArrayOperatorsTest.xtend index afe0fd2f2..7e370870f 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/CreateArrayOperatorsTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/CreateArrayOperatorsTest.xtend @@ -43,9 +43,9 @@ class CreateArrayOperatorsTest val model = ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; - ℝ x, y; + real x, y; iterate n while (n < 2); @@ -78,10 +78,10 @@ class CreateArrayOperatorsTest val model = ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; - ℝ[2] x, y; - ℝ[3] z; + real[2] x, y; + real[3] z; iterate n while (n < 2); @@ -122,10 +122,10 @@ class CreateArrayOperatorsTest val model = ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; - ℝ[2] x, y; - ℝ[3] z; + real[2] x, y; + real[3] z; iterate n while (n < 2); diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceAffectationsTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceAffectationsTest.xtend index 077e854ac..dcf044dd5 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceAffectationsTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceAffectationsTest.xtend @@ -39,11 +39,11 @@ class ReplaceAffectationsTest val model = ''' «testModule» - ℝ[2] X{nodes}; - ℝ x, y; - ℝ[5] a, b; - ℝ u{cells}; - ℝ[4] v{cells}; + real[2] X{nodes}; + real x, y; + real[5] a, b; + real u{cells}; + real[4] v{cells}; iterate n while (n < 2); diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceOptionsByLocalVariablesTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceOptionsByLocalVariablesTest.xtend index 4c1f20d7f..2d04943be 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceOptionsByLocalVariablesTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/ir/transformers/ReplaceOptionsByLocalVariablesTest.xtend @@ -41,9 +41,9 @@ class ReplaceOptionsByLocalVariablesTest val model = ''' «testModule» - ℝ[2] X{nodes}; - ℝ my_opt; - ℝ u{cells}; + real[2] X{nodes}; + real my_opt; + real u{cells}; iterate n while (n < 2); diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ArgOrVarTypeProviderTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ArgOrVarTypeProviderTest.xtend index 46be32630..a0897958e 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ArgOrVarTypeProviderTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ArgOrVarTypeProviderTest.xtend @@ -66,7 +66,7 @@ class ArgOrVarTypeProviderTest ''' linearalgebra extension LinearAlgebra; - def solveLinearSystem: x | ℝ[x, x] × ℝ[x] → ℝ[x], (a, b) → return b; + def solveLinearSystem: x | real[x, x] × real[x] → real[x], (a, b) → return b; ''' val nablaModel = @@ -76,62 +76,62 @@ class ArgOrVarTypeProviderTest with LinearAlgebra.*; with CartesianMesh2D.*; - def norm: x | ℝ[x] → ℝ, (a) → return 1.0; + def norm: x | real[x] → real, (a) → return 1.0; // bool scalar - ℾ b; - let ℾ optb = false; + bool b; + let bool optb = false; // int scalar - ℕ i; - let ℕ opti = 3; + int i; + let int opti = 3; // real scalar - ℝ r; - let ℝ optr = 3.3; + real r; + let real optr = 3.3; // bool array 1D - ℾ[2] tabb; - let ℾ[3] opttabb = [ true, false, true ]; + bool[2] tabb; + let bool[3] opttabb = [ true, false, true ]; // int array 1D - ℕ[2] tabi; - let ℕ[3] opttabi = [ 3, 4, 5 ]; + int[2] tabi; + let int[3] opttabi = [ 3, 4, 5 ]; // real array 1D - ℝ[2] tabr; - let ℝ[3] opttabr = [ 1.1, 2.2, 3.3 ]; + real[2] tabr; + let real[3] opttabr = [ 1.1, 2.2, 3.3 ]; // bool array 2D - ℾ[2, 3] tab2b; - let ℾ[3, 2] opttab2b = [ [true, false], [true, false], [true, false] ]; + bool[2, 3] tab2b; + let bool[3, 2] opttab2b = [ [true, false], [true, false], [true, false] ]; // int array 2D - ℕ[2, 3] tab2i; - let ℕ[3, 2] opttab2i = [ [1, 2], [3, 4], [5, 6] ]; + int[2, 3] tab2i; + let int[3, 2] opttab2i = [ [1, 2], [3, 4], [5, 6] ]; // real array 2D - ℝ[2, 3] tab2r; - let ℝ[3, 2] opttab2r = [ [1.1, 2.2], [3.3, 4.4], [5.5, 6.6] ]; + real[2, 3] tab2r; + let real[3, 2] opttab2r = [ [1.1, 2.2], [3.3, 4.4], [5.5, 6.6] ]; // array with size from a const - let ℕ dim = 6; - ℝ[dim] dimtab; + let int dim = 6; + real[dim] dimtab; // dynamic array not allowed on global variables // except with options - ℕ dyndimopt; - ℝ[dyndimopt] dyndimtabopt; + int dyndimopt; + real[dyndimopt] dyndimtabopt; // connectivity variables - ℝ[2] X{nodes}; - ℝ pressure{cells}; - ℝ Cjr{cells, nodesOfCell}; - ℝ[2] w{cells, nodesOfCell}; + real[2] X{nodes}; + real pressure{cells}; + real Cjr{cells, nodesOfCell}; + real[2] w{cells, nodesOfCell}; // linear algebra - ℝ u{cells}; - ℝ α{cells, cells}; + real u{cells}; + real α{cells, cells}; iterate n while (true); @@ -139,7 +139,7 @@ class ArgOrVarTypeProviderTest // local variable ComputeX: ∀ j∈cells(), { - let ℝ ee = 1.0; + let real ee = 1.0; u^{n}{j} = ee * 4; ∀r∈nodesOfCell(j), Cjr{j,r} = norm(w{j,r}); } diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ExpressionTypeProviderTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ExpressionTypeProviderTest.xtend index 2356bbca0..83e7c152b 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ExpressionTypeProviderTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/typeprovider/ExpressionTypeProviderTest.xtend @@ -60,7 +60,7 @@ class ExpressionTypeProviderTest ''' linearalgebra extension LinearAlgebra; - def solveLinearSystem: x | ℝ[x, x] × ℝ[x] → ℝ[x], (a, b) → return b; + def solveLinearSystem: x | real[x, x] × real[x] → real[x], (a, b) → return b; ''' val nablaModel = @@ -70,62 +70,62 @@ class ExpressionTypeProviderTest with LinearAlgebra.*; with CartesianMesh2D.*; - def reduceMin, ℝ.MaxValue: ℝ, (a, b) → return a; - - def perp: ℝ[2] → ℝ[2], (a) → return a; - def norm: x | ℝ[x] → ℝ, (a) → return 1.0; - - let ℝ X_EDGE_LENGTH = 1.; - let ℝ Y_EDGE_LENGTH = X_EDGE_LENGTH; - let ℕ X_EDGE_ELEMS = 2; - let ℕ Y_EDGE_ELEMS = 2; - let ℝ option_stoptime = 0.1; - let ℕ option_max_iterations = 500; - - let ℕ a1 = 1; - let ℕ a2 = 9 % 4; - let ℕ a3 = ℕ.MinValue; - let ℕ[2] a4 = [1,1]; - let ℕ[2] a5 = ℕ[2](1); - let ℕ[2,2] a6 = ℕ[2,2](1); - let ℕ a7 = a6[0,2]; - - let ℾ b1 = true; - let ℾ b2 = false || true; - let ℾ b3 = false && true; - let ℾ b4 = (a1 == 2); - let ℾ b5 = (a1 != 2); - let ℾ b6 = (a1 > 2); - let ℾ b7 = (a1 >= 2); - let ℾ b8 = (a1 <= 2); - let ℾ b9 = (a1 < 2); - let ℾ b10 = !(a1 < 2); - - let ℝ c1 = 2.0 + 1.0; - let ℝ c2 = 2.0 - 1.0; - let ℝ c3 = 2.0 * 1.0; - let ℝ c4 = 2.0 / 1.0; - let ℝ c5 = -c1; - let ℝ c6 = ℝ.MaxValue; - let ℝ c7 = 1.0e-10; - - let ℝ[2] d1 = [1.0, 2.0]; - let ℝ[2] d2 = perp(d1); - let ℝ[2] d3 = ℝ[2](0.); - - let ℝ[3] e = [1.0, 2.0, 3.0]; - - let ℝ[2,2] g = [ [1.0, 0.0], [0.0, 1.0] ]; - let ℝ h = (a1 == 1 ? 0.0 : 1.0); - - ℝ t; - ℝ[2] X{nodes}; - - ℕ s{cells}; - ℝ u{cells}, v{cells}; - ℝ[2] w{cells, nodesOfCell}; - ℝ x{cells, nodesOfCell}; - ℝ α{cells, cells}; + def reduceMin, real.MaxValue: real, (a, b) → return a; + + def perp: real[2] → real[2], (a) → return a; + def norm: x | real[x] → real, (a) → return 1.0; + + let real X_EDGE_LENGTH = 1.; + let real Y_EDGE_LENGTH = X_EDGE_LENGTH; + let int X_EDGE_ELEMS = 2; + let int Y_EDGE_ELEMS = 2; + let real option_stoptime = 0.1; + let int option_max_iterations = 500; + + let int a1 = 1; + let int a2 = 9 % 4; + let int a3 = int.MinValue; + let int[2] a4 = [1,1]; + let int[2] a5 = int[2](1); + let int[2,2] a6 = int[2,2](1); + let int a7 = a6[0,2]; + + let bool b1 = true; + let bool b2 = false || true; + let bool b3 = false && true; + let bool b4 = (a1 == 2); + let bool b5 = (a1 != 2); + let bool b6 = (a1 > 2); + let bool b7 = (a1 >= 2); + let bool b8 = (a1 <= 2); + let bool b9 = (a1 < 2); + let bool b10 = !(a1 < 2); + + let real c1 = 2.0 + 1.0; + let real c2 = 2.0 - 1.0; + let real c3 = 2.0 * 1.0; + let real c4 = 2.0 / 1.0; + let real c5 = -c1; + let real c6 = real.MaxValue; + let real c7 = 1.0e-10; + + let real[2] d1 = [1.0, 2.0]; + let real[2] d2 = perp(d1); + let real[2] d3 = real[2](0.); + + let real[3] e = [1.0, 2.0, 3.0]; + + let real[2,2] g = [ [1.0, 0.0], [0.0, 1.0] ]; + let real h = (a1 == 1 ? 0.0 : 1.0); + + real t; + real[2] X{nodes}; + + int s{cells}; + real u{cells}, v{cells}; + real[2] w{cells, nodesOfCell}; + real x{cells, nodesOfCell}; + real α{cells, cells}; iterate n while (n < option_max_iterations); @@ -134,7 +134,7 @@ class ExpressionTypeProviderTest ComputeV: ∀j∈cells(), v{j} = reduceMin{r∈nodesOfCell(j)}(x{j,r} + s{j}); ComputeX: ∀ j∈cells(), { - let ℝ ee = 1.0; + let real ee = 1.0; u^{n}{j} = ee * 4; ∀r∈nodesOfCell(j), x{j,r} = norm(w{j,r}); } diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ArgOrVarRefValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ArgOrVarRefValidatorTest.xtend index 713d82616..b4d545c45 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ArgOrVarRefValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ArgOrVarRefValidatorTest.xtend @@ -43,10 +43,10 @@ class ArgOrVarRefValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℕ[2,2] a = ℕ[2,2](0); - let ℕ[2] b = a[0]; // Wrong number of args - let ℕ[2] c = ℕ[2](0); - let ℕ d = c[0,1]; // Wrong number of args + let int[2,2] a = int[2,2](0); + let int[2] b = a[0]; // Wrong number of args + let int[2] c = int[2](0); + let int d = c[0,1]; // Wrong number of args ''') Assert.assertNotNull(moduleKo) @@ -61,8 +61,8 @@ class ArgOrVarRefValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ[2,2] a = ℕ[2,2](0); - let ℕ b = a[0,0]; + let int[2,2] a = int[2,2](0); + let int b = a[0,0]; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -76,7 +76,7 @@ class ArgOrVarRefValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ u{cells}, v{cells, nodesOfCell}, w{nodes}; + real u{cells}, v{cells, nodesOfCell}, w{nodes}; ComputeU: ∀ j∈cells(), ∀r∈nodesOfCell(j), u{j,r} = 1.; ComputeV: ∀ j∈cells(), ∀r∈nodesOfCell(j), v{j} = 1.; ComputeW: ∀ j∈cells(), w{j} = 1.; @@ -98,7 +98,7 @@ class ArgOrVarRefValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ u{cells}, v{cells, nodesOfCell}, w{nodes}; + real u{cells}, v{cells, nodesOfCell}, w{nodes}; ComputeU: ∀ j∈cells(), ∀r∈nodesOfCell(j), u{j} = 1.; ComputeV: ∀ j∈cells(), ∀r∈nodesOfCell(j), v{j,r} = 1.; ComputeW: ∀ j∈nodes(), w{j} = 1.; @@ -115,7 +115,7 @@ class ArgOrVarRefValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ComputeV: v = u + 4.0; // Wrong: must be u^{n} @@ -129,7 +129,7 @@ class ArgOrVarRefValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ComputeV: v = u^{n} + 4.0; // Wrong: must be u^{n} @@ -146,8 +146,8 @@ class ArgOrVarRefValidatorTest val moduleKo1 = parseHelper.parse( ''' «testModule» - let ℝ u=0; - ℝ v; + let real u=0; + real v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ComputeV: v = u + 4.0; // Wrong: must be u^{n} @@ -160,8 +160,8 @@ class ArgOrVarRefValidatorTest val moduleKo2 = parseHelper.parse( ''' «testModule» - let ℝ u = 3.4; - ℝ v; + let real u = 3.4; + real v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ComputeV: v = u + 4.0; // Wrong: must be u^{n} @@ -174,7 +174,7 @@ class ArgOrVarRefValidatorTest val moduleKo3 = parseHelper.parse( ''' «testModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + n^{n} + 6.0; ComputeV: v = u + 4.0; // Wrong: must be u^{n} @@ -187,7 +187,7 @@ class ArgOrVarRefValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ComputeV: v = u^{n} + 4.0; // Wrong: must be u^{n} @@ -204,35 +204,35 @@ class ArgOrVarRefValidatorTest val moduleKo1 = parseHelper.parse( ''' «testModule» - let ℕ[2] a = ℕ[2](0); - let ℕ m = a[2.3]; + let int[2] a = int[2](0); + let int m = a[2.3]; ''', rs) Assert.assertNotNull(moduleKo1) moduleKo1.assertError(NablaPackage.eINSTANCE.argOrVarRef, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) val moduleKo2 = parseHelper.parse( ''' «testModule» - let ℕ[2] a = ℕ[2](0); - let ℝ b = 1.2; - let ℕ o = a[b]; + let int[2] a = int[2](0); + let real b = 1.2; + let int o = a[b]; ''', rs) Assert.assertNotNull(moduleKo2) moduleKo2.assertError(NablaPackage.eINSTANCE.argOrVarRef, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) val moduleOk = parseHelper.parse( ''' «testModule» - let ℕ[2] a = ℕ[2](0); - let ℕ b = 1; + let int[2] a = int[2](0); + let int b = 1; - let ℕ m = a[2]; - let ℕ o = a[b]; - let ℕ p = a[b + 4]; + let int m = a[2]; + let int o = a[b]; + let int p = a[b + 4]; ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -246,8 +246,8 @@ class ArgOrVarRefValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; - ℝ x{nodes}; + real[2] X{nodes}; + real x{nodes}; InitY : y = X[1]; // wrong syntax. Precise space iterator before indice ''', rs) Assert.assertNotNull(moduleKo) @@ -259,8 +259,8 @@ class ArgOrVarRefValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; - ℝ y{nodes}; + real[2] X{nodes}; + real y{nodes}; InitY : ∀r ∈nodes(), y{r} = X{r}[1]; ''', rs) Assert.assertNotNull(moduleOk) diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/BasicValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/BasicValidatorTest.xtend index 3f764b8ec..2c210b6d6 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/BasicValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/BasicValidatorTest.xtend @@ -56,8 +56,8 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' module Test; - ℝ a{CartesianMesh2D.nodes}; - ℝ b{BidonMesh.nodes}; + real a{CartesianMesh2D.nodes}; + real b{BidonMesh.nodes}; ''', rs) moduleKo.assertError(NablaPackage.eINSTANCE.nablaRoot, @@ -70,8 +70,8 @@ class BasicValidatorTest ''' module Test; with CartesianMesh2D.*; - ℝ a{nodes}; - ℝ b{nodes}; + real a{nodes}; + real b{nodes}; ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -85,9 +85,9 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' extension Test; - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[1;3[, n[i] = 0.0; return 4.0; } @@ -99,9 +99,9 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;3[, n[i] = 0.0; return 4.0; } @@ -116,24 +116,24 @@ class BasicValidatorTest val moduleKo1 = parseHelper.parse( ''' extension Test; - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;3.2[, n[i] = 0.0; return 4.0; } ''') moduleKo1.assertError(NablaPackage.eINSTANCE.interval, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) val moduleKo2 = parseHelper.parse( ''' extension Test; - def g: → ℝ, () → + def g: → real, () → { - let ℝ x = 6.7; - ℝ[4] n; + let real x = 6.7; + real[4] n; ∀ i∈[0;x[, n[i] = 0.0; return 4.0; } @@ -141,14 +141,14 @@ class BasicValidatorTest moduleKo2.assertError(NablaPackage.eINSTANCE.interval, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) val moduleOk = parseHelper.parse( ''' extension Test; - def g: → ℝ, () → + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;4[, n[i] = 0.0; return 4.0; } @@ -165,7 +165,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' module test; - ℝ u; + real u; iterate n while(true); ComputeUinit: u^{n=0} = 0.0; ''') @@ -176,7 +176,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' module Test; - ℝ u; + real u; iterate n while(true); ComputeUinit: u^{n=0} = 0.0; ''') @@ -199,7 +199,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' module Test; - ℝ u; + real u; iterate n while(true); computeUinit: u^{n=0} = 0.0; ''') @@ -211,7 +211,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' module Test; - ℝ u; + real u; iterate n while(true); ComputeUinit: u^{n=0} = 0.0; ''') @@ -225,10 +225,10 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' extension Test; - def ∑, 0.0: ℝ, (a, b) → return a + b; - def G: → ℝ, () → + def ∑, 0.0: real, (a, b) → return a + b; + def G: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;3[, n[i] = 0.0; return 4.0; } @@ -241,10 +241,10 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def ∑, 0.0: ℝ, (a, b) → return a + b; - def g: → ℝ, () → + def ∑, 0.0: real, (a, b) → return a + b; + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;3[, n[i] = 0.0; return 4.0; } @@ -261,7 +261,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeUinit: u^{n=1} = 0.0; ComputeU: u^{n+1} = u^{n} + 6.0; @@ -275,7 +275,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeUinit: u^{n=0} = 0.0; ComputeU: u^{n+1} = u^{n} + 6.0; @@ -290,8 +290,8 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℝ u, v; - ℕ ni; + real u, v; + int ni; iterate n counter ni while(true); ComputeU: u^{n+2} = u^{n} + 6.0; ''') @@ -304,7 +304,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ''') @@ -318,7 +318,7 @@ class BasicValidatorTest val moduleKo1 = parseHelper.parse( ''' «emptyTestModule» - ℝ[3] x; + real[3] x; iterate n while(∑{x∈[0;3[}(x[i]])); ''') Assert.assertNotNull(moduleKo1) @@ -329,18 +329,18 @@ class BasicValidatorTest val moduleKo2 = parseHelper.parse( ''' «emptyTestModule» - ℝ[3] x; + real[3] x; iterate n while(x[0]); ''') Assert.assertNotNull(moduleKo2) moduleKo2.assertError(NablaPackage.eINSTANCE.timeIterator, BasicValidator::CONDITION_BOOL, - getTypeMsg("ℝ", "ℾ")) + getTypeMsg("real", "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ[3] x; + real[3] x; iterate n while(x[0] > 0.0); ''') Assert.assertNotNull(moduleOk) @@ -353,7 +353,7 @@ class BasicValidatorTest val moduleKo1 = parseHelper.parse( ''' «emptyTestModule» - ℝ u; + real u; iterate n while(true), { k while (true); @@ -369,7 +369,7 @@ class BasicValidatorTest val moduleKo2 = parseHelper.parse( ''' «emptyTestModule» - ℝ u; + real u; iterate n while(true), { k while (true); @@ -385,7 +385,7 @@ class BasicValidatorTest val moduleKo3 = parseHelper.parse( ''' «emptyTestModule» - ℝ u; + real u; iterate n while(true), { k while (true); @@ -401,7 +401,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ u; + real u; iterate n while(true), { k while (true); @@ -421,7 +421,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℝ[1, 2, 3] a; + real[1, 2, 3] a; ''') Assert.assertNotNull(moduleKo) @@ -432,7 +432,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ[1, 2] a; + real[1, 2] a; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -444,26 +444,26 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ x = 2.2; - ℝ[1.1] a; - ℕ[x] b; + let real x = 2.2; + real[1.1] a; + int[x] b; ''') Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.baseType, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) moduleKo.assertError(NablaPackage.eINSTANCE.baseType, BasicValidator::TYPE_EXPRESSION_TYPE, - getTypeMsg("ℝ", "ℕ")) + getTypeMsg("real", "int")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ x = 2; - ℝ[2] a; - ℕ[x] b; + let int x = 2; + real[2] a; + int[x] b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -481,7 +481,7 @@ class BasicValidatorTest ''' «testModule» let orig = [0.0 , 0.0] ; - ℝ[2] X{nodes}; + real[2] X{nodes}; IniX1: ∀j∈cells(), ∀r∈nodes(j), X{r} = orig; IniX2: ∀r∈nodes(), ∀j∈nodesOfCell(r), X{r} = orig; ''', rs) as NablaModule @@ -498,8 +498,8 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - let ℝ[2] orig = [0.0 , 0.0]; - ℝ[2] X{nodes}; + let real[2] orig = [0.0 , 0.0]; + real[2] X{nodes}; IniX1: ∀j∈cells(), ∀r∈nodes(), X{r} = orig; IniX2: ∀j∈cells(), ∀r∈nodesOfCell(j), X{r} = orig; ''', rs) @@ -515,7 +515,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodesOfCell}; + real[2] X{nodesOfCell}; ''', rs) Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.connectivityVar, @@ -525,7 +525,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -539,8 +539,8 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodesOfCell}; - ℕ toto{cells, nodesOfCell, nodes}; + real[2] X{nodesOfCell}; + int toto{cells, nodesOfCell, nodes}; ''', rs) Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.connectivityVar, @@ -550,8 +550,8 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; - ℕ toto{cells, nodes, nodesOfCell}; + real[2] X{nodes}; + int toto{cells, nodes, nodesOfCell}; ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -567,7 +567,7 @@ class BasicValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ[2] X{cells}; + real[2] X{cells}; UpdateX: ∀j1∈cells(), ∀j2∈leftCell(j1), X{j2} = X{j2-1} - 1; ''', rs) Assert.assertNotNull(moduleKo) @@ -579,7 +579,7 @@ class BasicValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ[2] X{cells}; + real[2] X{cells}; UpdateX: ∀j1∈cells(), ∀j2∈leftCell(j1), X{j2} = X{j1-1} - 1; ''', rs) Assert.assertNotNull(moduleOk) diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ExpressionValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ExpressionValidatorTest.xtend index f2ae1a0f7..ff07e4ce2 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ExpressionValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/ExpressionValidatorTest.xtend @@ -51,11 +51,11 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ[2] one = [1.0, 1.0]; - let ℕ int = ℕ(1.2); - let ℾ bool = ℾ(1); - let ℝ real = ℝ(true); - let ℝ[2] realOne = ℝ[2](one); + let real[2] one = [1.0, 1.0]; + let int int_ = int(1.2); + let bool bool_ = bool(1); + let real real_ = real(true); + let real[2] realOne = real[2](one); ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(4, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -75,15 +75,15 @@ class ExpressionValidatorTest moduleKo.assertError(NablaPackage.eINSTANCE.baseTypeConstant, ExpressionValidator::BASE_TYPE_CONSTANT_VALUE, - getTypeMsg("ℝ²", PrimitiveType::REAL.literal)) + getTypeMsg("real²", PrimitiveType::REAL.literal)) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ int = ℕ(1); - let ℾ bool = ℾ(true); - let ℝ real = ℝ(1.2); - let ℝ[2] realOne = ℝ[2](1.0); + let int int_ = int(1); + let bool bool_ = bool(true); + let real real_ = real(1.2); + let real[2] realOne = real[2](1.0); ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -98,15 +98,15 @@ class ExpressionValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - def test: ℾ × ℝ × ℝ[2] → ℝ, (a, b, c) → return b; - let ℝ[2] opt = [0., 1.]; - let ℕ count = 1; - ℝ alpha{cells}; + def test: bool × real × real[2] → real, (a, b, c) → return b; + let real[2] opt = [0., 1.]; + let int count = 1; + real alpha{cells}; ''' val moduleKo = parseHelper.parse( ''' «model» - J1: let ℝ x = test(true, 0, opt); + J1: let real x = test(true, 0, opt); ''', rs) Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -122,7 +122,7 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «model» - J1: let ℝ x = test(true, 0., opt); + J1: let real x = test(true, 0., opt); ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -137,11 +137,11 @@ class ExpressionValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - def sum, 0.0: ℝ, (a, b) → return a + b; - ℝ D{cells}; - ℝ[2] E{cells}; - ComputeU: let ℝ u = sum{c∈cells()}(D); - ComputeV: let ℝ[2] v = sum{c∈cells()}(E{c}); + def sum, 0.0: real, (a, b) → return a + b; + real D{cells}; + real[2] E{cells}; + ComputeU: let real u = sum{c∈cells()}(D); + ComputeV: let real[2] v = sum{c∈cells()}(E{c}); ''', rs) Assert.assertNotNull(moduleKo) Assert.assertEquals(2, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -158,12 +158,12 @@ class ExpressionValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - def sum, 0.0: ℝ, (a,b) → return a + b; - def sum, 0.0: x | ℝ[x], (a,b) → return a + b; - ℝ D{cells}; - ℝ[2] E{cells}; - ComputeU: let ℝ u = sum{c∈cells()}(D{c}); - ComputeV: let ℝ[2] v = sum{c∈cells()}(E{c}); + def sum, 0.0: real, (a,b) → return a + b; + def sum, 0.0: x | real[x], (a,b) → return a + b; + real D{cells}; + real[2] E{cells}; + ComputeU: let real u = sum{c∈cells()}(D{c}); + ComputeV: let real[2] v = sum{c∈cells()}(E{c}); ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -175,10 +175,10 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ cond = 0.0; - let ℝ U = 1.1; - let ℕ V = 2; - let ℝ W = (cond ? U : V); + let real cond = 0.0; + let real U = 1.1; + let int V = 2; + let real W = (cond ? U : V); ''') as NablaModule Assert.assertNotNull(moduleKo) Assert.assertEquals(2, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -189,7 +189,7 @@ class ExpressionValidatorTest moduleKo.assertError(NablaPackage.eINSTANCE.contractedIf, ExpressionValidator::CONTRACTED_IF_CONDITION_TYPE, - getTypeMsg(cond.typeFor.label, "ℾ")) + getTypeMsg(cond.typeFor.label, "bool")) moduleKo.assertError(NablaPackage.eINSTANCE.contractedIf, ExpressionValidator::CONTRACTED_IF_ELSE_TYPE, @@ -198,10 +198,10 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℾ cond = true; - let ℝ U = 0.0; - let ℝ V = 1.1; - let ℝ W = (cond ? U : V); + let bool cond = true; + let real U = 0.0; + let real V = 1.1; + let real W = (cond ? U : V); ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -213,8 +213,8 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ cond = 0.0; - let ℾ ok = !cond; + let real cond = 0.0; + let bool ok = !cond; ''') as NablaModule Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -223,13 +223,13 @@ class ExpressionValidatorTest moduleKo.assertError(NablaPackage.eINSTANCE.not, ExpressionValidator::NOT_EXPRESSION_TYPE, - getTypeMsg(cond.typeFor.label, "ℾ")) + getTypeMsg(cond.typeFor.label, "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℾ cond = true; - let ℾ ok = !cond; + let bool cond = true; + let bool ok = !cond; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -241,9 +241,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℾ a = true; - let ℝ b = 0.0; - let ℝ c = a * b; + let bool a = true; + let real b = 0.0; + let real c = a * b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -258,9 +258,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 1.1; - let ℝ b = 0.0; - let ℝ c = a * b; + let real a = 1.1; + let real b = 0.0; + let real c = a * b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -272,9 +272,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℾ a = true; - let ℝ b = 0.0; - let ℝ c = a / b; + let bool a = true; + let real b = 0.0; + let real c = a / b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -289,9 +289,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 1.1; - let ℝ b = 0.0; - let ℝ c = a / b; + let real a = 1.1; + let real b = 0.0; + let real c = a / b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -303,9 +303,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℾ a = true; - let ℕ b = 0; - let ℝ c = a + b; + let bool a = true; + let int b = 0; + let real c = a + b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -320,9 +320,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 1.1; - let ℕ b = 0; - let ℝ c = a + b; + let real a = 1.1; + let int b = 0; + let real c = a + b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -334,9 +334,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ[2] a = ℝ[2](0.0); - let ℝ[3] b = ℝ[3](0.0); - let ℝ[2] c = a - b; + let real[2] a = real[2](0.0); + let real[3] b = real[3](0.0); + let real[2] c = a - b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -352,9 +352,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ[2] a = ℝ[2](0.0); - let ℝ[2] b = ℝ[2](1.1); - let ℝ[2] c = a - b; + let real[2] a = real[2](0.0); + let real[2] b = real[2](1.1); + let real[2] c = a - b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -366,9 +366,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 0.0; - let ℝ[2] b = ℝ[2](1.1); - let ℾ c = a > b; + let real a = 0.0; + let real[2] b = real[2](1.1); + let bool c = a > b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -383,9 +383,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 0.0; - let ℝ b = 1.1; - let ℾ c = a > b; + let real a = 0.0; + let real b = 1.1; + let bool c = a > b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -397,9 +397,9 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 0.0; - let ℝ[2] b = ℝ[2](1.1); - let ℾ c = a == b; + let real a = 0.0; + let real[2] b = real[2](1.1); + let bool c = a == b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -414,9 +414,9 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 0.0; - let ℝ b = 1.1; - let ℾ c = a == b; + let real a = 0.0; + let real b = 1.1; + let bool c = a == b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -428,27 +428,27 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℝ a = 0.0; - let ℝ[2] b = ℝ[2](1.1); - let ℕ c = a % b; + let real a = 0.0; + let real[2] b = real[2](1.1); + let int c = a % b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(2, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) moduleKo.assertError(NablaPackage.eINSTANCE.modulo, ExpressionValidator::MODULO_TYPE, - getTypeMsg(PrimitiveType::REAL.literal, "ℕ")) + getTypeMsg(PrimitiveType::REAL.literal, "int")) moduleKo.assertError(NablaPackage.eINSTANCE.modulo, ExpressionValidator::MODULO_TYPE, - getTypeMsg(new NSTRealArray1D(createIntConstant(2), 2).label, "ℕ")) + getTypeMsg(new NSTRealArray1D(createIntConstant(2), 2).label, "int")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ a = 0; - let ℕ b = 1; - let ℕ c = a % b; + let int a = 0; + let int b = 1; + let int c = a % b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -460,27 +460,27 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℕ a = 0; - let ℝ b = 1.1; - let ℾ c = a && b; + let int a = 0; + let real b = 1.1; + let bool c = a && b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(2, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) moduleKo.assertError(NablaPackage.eINSTANCE.and, ExpressionValidator::AND_TYPE, - getTypeMsg(PrimitiveType::REAL.literal, "ℾ")) + getTypeMsg(PrimitiveType::REAL.literal, "bool")) moduleKo.assertError(NablaPackage.eINSTANCE.and, ExpressionValidator::AND_TYPE, - getTypeMsg(PrimitiveType::INT.literal, "ℾ")) + getTypeMsg(PrimitiveType::INT.literal, "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℾ a = true; - let ℾ b = false; - let ℾ c = a && b; + let bool a = true; + let bool b = false; + let bool c = a && b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -492,27 +492,27 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℕ a = 0; - let ℝ b = 1.1; - let ℾ c = a || b; + let int a = 0; + let real b = 1.1; + let bool c = a || b; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(2, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) moduleKo.assertError(NablaPackage.eINSTANCE.or, ExpressionValidator::OR_TYPE, - getTypeMsg(PrimitiveType::REAL.literal, "ℾ")) + getTypeMsg(PrimitiveType::REAL.literal, "bool")) moduleKo.assertError(NablaPackage.eINSTANCE.or, ExpressionValidator::OR_TYPE, - getTypeMsg(PrimitiveType::INT.literal, "ℾ")) + getTypeMsg(PrimitiveType::INT.literal, "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℾ a = true; - let ℾ b = false; - let ℾ c = a || b; + let bool a = true; + let bool b = false; + let bool c = a || b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -524,7 +524,7 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℕ[1] V = [0]; + let int[1] V = [0]; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -536,7 +536,7 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - letℕ[2] V = [0, 1]; + letint[2] V = [0, 1]; ''') Assert.assertNotNull(moduleOk) } @@ -547,7 +547,7 @@ class ExpressionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - let ℕ[2] V = [0, 3.4]; + let int[2] V = [0, 3.4]; ''') Assert.assertNotNull(moduleKo) Assert.assertEquals(1, moduleKo.validate.filter(i | i.severity == Severity.ERROR).size) @@ -559,7 +559,7 @@ class ExpressionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ[2] V = [0, 3]; + let int[2] V = [0, 3]; ''') Assert.assertNotNull(moduleOk) } @@ -570,10 +570,10 @@ class ExpressionValidatorTest val extensionKo = parseHelper.parse( ''' extension Test; - def f: → ℝ; - def g: → ℝ, () → + def f: → real; + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;4[, n[i] = 0.0; return f(); } @@ -588,10 +588,10 @@ class ExpressionValidatorTest val extensionOk = parseHelper.parse( ''' extension Test; - def f: → ℝ; - def g: → ℝ, () → + def f: → real; + def g: → real, () → { - ℝ[4] n; + real[4] n; ∀ i∈[0;4[, n[i] = 0.0; return 4.0; } diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/FunctionOrReductionValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/FunctionOrReductionValidatorTest.xtend index 858e502bc..bc628cf6e 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/FunctionOrReductionValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/FunctionOrReductionValidatorTest.xtend @@ -45,7 +45,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ; + def f: real → real; ''') Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.functionOrReduction, @@ -56,7 +56,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → { return 1.0; } + def f: real → real, (a) → { return 1.0; } ''') Assert.assertNotNull(moduleOk) } @@ -69,9 +69,9 @@ class FunctionOrReductionValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℕ U{cells}; + int U{cells}; ComputeU: ∀ j∈cells(), { - let ℕ e = 1; + let int e = 1; U{j} = e * 4; return e; } @@ -84,9 +84,9 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℕ U{cells}; + int U{cells}; ComputeU: ∀ j∈cells(), { - let ℕ e = 1; + let int e = 1; U{j} = e * 4; } ''', rs) @@ -101,7 +101,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → { let x = 1; } + def f: real → real, (a) → { let x = 1; } ''') Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.functionOrReduction, @@ -112,7 +112,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → { return 1.0; } + def f: real → real, (a) → { return 1.0; } ''') Assert.assertNotNull(moduleOk) } @@ -124,10 +124,10 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → + def f: real → real, (a) → { return 1.0; - let ℕ x = 1; + let int x = 1; } ''') Assert.assertNotNull(moduleKo) @@ -139,7 +139,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → + def f: real → real, (a) → { return 1.0; } @@ -153,7 +153,7 @@ class FunctionOrReductionValidatorTest val modulekO = parseHelper.parse( ''' extension Test; - def f: x | ℝ[x+1] → ℝ[x]; + def f: x | real[x+1] → real[x]; ''') Assert.assertNotNull(modulekO) @@ -164,7 +164,7 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def f: x | ℝ[x] → ℝ[x+1]; + def f: x | real[x] → real[x+1]; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -176,7 +176,7 @@ class FunctionOrReductionValidatorTest val modulekO = parseHelper.parse( ''' extension Test; - def sum, 0.0: x,y | ℝ[x+y], (a,b) → return a + b; + def sum, 0.0: x,y | real[x+y], (a,b) → return a + b; ''') Assert.assertNotNull(modulekO) @@ -187,7 +187,7 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def sum, 0.0: x | ℝ[x], (a,b) → return a + b; + def sum, 0.0: x | real[x], (a,b) → return a + b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -200,7 +200,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a, b) → + def f: real → real, (a, b) → { return 1.0; } @@ -214,7 +214,7 @@ class FunctionOrReductionValidatorTest ''' module Test; - def f: ℝ → ℝ, (a) → + def f: real → real, (a) → { return 1.0; } @@ -228,8 +228,8 @@ class FunctionOrReductionValidatorTest val modulekO = parseHelper.parse( ''' extension Test; - def g: ℝ[2] → ℝ; - def g: x | ℝ[x] → ℝ; + def g: real[2] → real; + def g: x | real[x] → real; ''') Assert.assertNotNull(modulekO) @@ -240,8 +240,8 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def g: ℝ → ℝ; - def g: x | ℝ[x] → ℝ; + def g: real → real; + def g: x | real[x] → real; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -252,13 +252,13 @@ class FunctionOrReductionValidatorTest { val model = ''' extension Test; - def f: ℝ → ℝ, (a) → { return 1; } - def g: ℝ → ℝ, (a) → { return 1.0; } + def f: real → real, (a) → { return 1; } + def g: real → real, (a) → { return 1.0; } ''' val module = parseHelper.parse(model) Assert.assertNotNull(module) Assert.assertEquals(1, module.validate.filter(i | i.severity == Severity.ERROR).size) - module.assertError(NablaPackage.eINSTANCE.functionTypeDeclaration, FunctionOrReductionValidator::FUNCTION_RETURN_TYPE, getTypeMsg("ℕ", "ℝ")) + module.assertError(NablaPackage.eINSTANCE.functionTypeDeclaration, FunctionOrReductionValidator::FUNCTION_RETURN_TYPE, getTypeMsg("int", "real")) } @Test @@ -267,7 +267,7 @@ class FunctionOrReductionValidatorTest val modulekO = parseHelper.parse( ''' extension Test; - def f: x | ℝ → ℝ[x]; + def f: x | real → real[x]; ''') Assert.assertNotNull(modulekO) modulekO.assertError(NablaPackage.eINSTANCE.functionTypeDeclaration, @@ -277,8 +277,8 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def f: x | ℝ[x] → ℝ[x]; - def g: y | ℝ[y] → ℝ[x, y]; + def f: x | real[x] → real[x]; + def g: y | real[y] → real[x, y]; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors(NablaPackage.eINSTANCE.functionTypeDeclaration, FunctionOrReductionValidator::FUNCTION_RETURN_TYPE_VAR) @@ -290,8 +290,8 @@ class FunctionOrReductionValidatorTest val modulekO = parseHelper.parse( ''' extension Test; - def g, 0.0: ℝ[2], (a, b) → return a; - def g, 0.0: x | ℝ[x], (a, b) → return a; + def g, 0.0: real[2], (a, b) → return a; + def g, 0.0: x | real[x], (a, b) → return a; ''') Assert.assertNotNull(modulekO) modulekO.assertError(NablaPackage.eINSTANCE.reduction, @@ -301,8 +301,8 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def g, 0.0: ℝ, (a, b) → return a; - def g, 0.0: x | ℝ[x], (a, b) → return a; + def g, 0.0: real, (a, b) → return a; + def g, 0.0: x | real[x], (a, b) → return a; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -314,8 +314,8 @@ class FunctionOrReductionValidatorTest val moduleKo = parseHelper.parse( ''' extension Test; - def sum1, [0.0, 0.0]: ℝ[2], (a, b) → return a + b; - def sum1, 0.0: ℕ, (a, b) → return a + b; + def sum1, [0.0, 0.0]: real[2], (a, b) → return a + b; + def sum1, 0.0: int, (a, b) → return a + b; ''') Assert.assertNotNull(moduleKo) @@ -330,8 +330,8 @@ class FunctionOrReductionValidatorTest val moduleOk = parseHelper.parse( ''' extension Test; - def sum1, 0.0: ℝ[2], (a, b) → return a + b; - def sum1, 0: ℕ, (a, b) → return a + b; + def sum1, 0.0: real[2], (a, b) → return a + b; + def sum1, 0: int, (a, b) → return a + b; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/InstructionValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/InstructionValidatorTest.xtend index a13dd678f..180bcb4f9 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/InstructionValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/InstructionValidatorTest.xtend @@ -45,8 +45,8 @@ class InstructionValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℕ dim; - ℝ[dim] X{nodes}; + int dim; + real[dim] X{nodes}; SetDim: dim = 2; ''', rs) Assert.assertNotNull(moduleKo) @@ -57,8 +57,8 @@ class InstructionValidatorTest val moduleKo2 = parseHelper.parse( ''' «testModule» - ℕ dim; - ℝ[dim] tab; + int dim; + real[dim] tab; ''', rs) Assert.assertNotNull(moduleKo2) moduleKo.assertError(NablaPackage.eINSTANCE.varGroupDeclaration, @@ -68,9 +68,9 @@ class InstructionValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - let ℕ dim = 2; - ℝ[dim] X{nodes}; - ℝ[dim] tab; + let int dim = 2; + real[dim] X{nodes}; + real[dim] tab; ''', rs) Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors @@ -84,10 +84,10 @@ class InstructionValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; UpdateX: { - ℝ[2] a{nodes}; + real[2] a{nodes}; ∀r∈nodes(), X{r} = a{r}; } ''', rs) @@ -99,10 +99,10 @@ class InstructionValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℝ[2] X{nodes}; + real[2] X{nodes}; UpdateX: { - ℝ[2] a; + real[2] a; ∀r∈nodes(), X{r} = a; } ''', rs) @@ -118,10 +118,10 @@ class InstructionValidatorTest val moduleKo = parseHelper.parse( ''' «testModule» - ℕ U{cells}; - ℕ V{nodes}; + int U{cells}; + int V{nodes}; ComputeU: ∀ j∈cells(), { - let ℝ e = 1.0; + let real e = 1.0; U{j} = e * 4; } ComputeV: V = U; @@ -133,7 +133,7 @@ class InstructionValidatorTest getTypeMsg(PrimitiveType::REAL.literal, PrimitiveType::INT.literal)) moduleKo.assertError(NablaPackage.eINSTANCE.affectation, InstructionValidator::AFFECTATION_TYPE, - getTypeMsg("ℕ{cells}", "ℕ{nodes}")) + getTypeMsg("int{cells}", "int{nodes}")) moduleKo.assertError(NablaPackage.eINSTANCE.affectation, InstructionValidator::AFFECTATION_ON_CONNECTIVITY_TYPE, InstructionValidator.getAffectationOnConnectivityTypeMsg) @@ -141,10 +141,10 @@ class InstructionValidatorTest val moduleOk = parseHelper.parse( ''' «testModule» - ℕ U{cells}; - ℕ V{cells}; + int U{cells}; + int V{cells}; ComputeU: ∀ j∈cells(), { - let ℕ e = 1; + let int e = 1; U{j} = e * 4; } ComputeV: ∀ j∈cells(), V{j} = U{j}; @@ -159,20 +159,20 @@ class InstructionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℕ cond; - ℕ a; + int cond; + int a; job: if (cond) { a = a + 1 ; } else { a = a -1 ; } ''') Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.^if, InstructionValidator::CONDITION_BOOL, - getTypeMsg(PrimitiveType::INT.literal, "ℾ")) + getTypeMsg(PrimitiveType::INT.literal, "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℾ cond; - ℕ a; + bool cond; + int a; Job: if (cond) { a = a + 1 ; } else { a = a -1 ; } ''') Assert.assertNotNull(moduleOk) @@ -185,20 +185,20 @@ class InstructionValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℕ cond; - ℕ a; + int cond; + int a; Job: while (cond) { a = a + 1 ; } ''') Assert.assertNotNull(moduleKo) moduleKo.assertError(NablaPackage.eINSTANCE.^while, InstructionValidator::CONDITION_BOOL, - getTypeMsg(PrimitiveType::INT.literal, "ℾ")) + getTypeMsg(PrimitiveType::INT.literal, "bool")) val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℾ cond; - ℕ a; + bool cond; + int a; Job: while (cond) { a = a + 1 ; } ''') Assert.assertNotNull(moduleOk) @@ -211,7 +211,7 @@ class InstructionValidatorTest val moduleKo1 = parseHelper.parse( ''' «emptyTestModule» - let ℕ coef = 2.0; + let int coef = 2.0; ''') Assert.assertNotNull(moduleKo1) moduleKo1.assertError(NablaPackage.eINSTANCE.simpleVarDeclaration, @@ -221,9 +221,9 @@ class InstructionValidatorTest val moduleKo2 = parseHelper.parse( ''' «emptyTestModule» - def mySum, 0: ℕ, (a, b) → return a + b; - let ℕ[3] coef = [2, 3, 4]; - let ℕ c = mySum{k∈[0;3[}(coef[k]); + def mySum, 0: int, (a, b) → return a + b; + let int[3] coef = [2, 3, 4]; + let int c = mySum{k∈[0;3[}(coef[k]); ''') Assert.assertNotNull(moduleKo2) moduleKo2.assertError(NablaPackage.eINSTANCE.simpleVarDeclaration, @@ -233,8 +233,8 @@ class InstructionValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - let ℕ coef = 2; - let ℝ DOUBLE_LENGTH = 0.1 * coef; + let int coef = 2; + let real DOUBLE_LENGTH = 0.1 * coef; ''') Assert.assertNotNull(moduleOk) moduleOk.assertNoErrors diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/NablagenValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/NablagenValidatorTest.xtend index 14b975d23..64543f631 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/NablagenValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/NablagenValidatorTest.xtend @@ -43,13 +43,13 @@ class NablagenValidatorTest with CartesianMesh2D.*; - let ℝ maxTime = 0.1; - let ℕ maxIter = 500; - let ℝ δt = 1.0; + let real maxTime = 0.1; + let int maxIter = 500; + let real δt = 1.0; - ℝ t; - ℝ[2] X{nodes}; - ℝ hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; + real t; + real[2] X{nodes}; + real hv1{cells}, hv2{cells}, hv3{cells}, hv4{cells}, hv5{cells}, hv6{cells}, hv7{cells}; iterate n while (n+1 < maxIter && t^{n+1} < maxTime); @@ -64,8 +64,8 @@ class NablagenValidatorTest with CartesianMesh2D.*; - ℝ[2] X{nodes}; - ℝ rv1{cells}, rv2{cells}, rv3{cells}; + real[2] X{nodes}; + real rv1{cells}, rv2{cells}, rv3{cells}; Rj1: ∀c∈cells(), rv2{c} = rv1{c}; Rj2: ∀c∈cells(), rv3{c} = rv2{c}; @@ -198,7 +198,7 @@ class NablagenValidatorTest assertNgen(koNgenModel, NablagenPackage.eINSTANCE.varLink, NablagenValidator::VAR_LINK_MAIN_VAR_TYPE, - NablagenValidator::getVarLinkMainVarTypeMsg("ℝ²{nodes}", "ℝ"), + NablagenValidator::getVarLinkMainVarTypeMsg("real²{nodes}", "real"), ngenModel) val okNgen = readModelsAndGetNgen(nablaHydroModel, nablaRemapModel, ngenModel) vth.assertNoErrors(okNgen) @@ -210,7 +210,7 @@ class NablagenValidatorTest val batiLibModel = ''' extension BatiLib; - def nextWaveHeight: → ℝ; + def nextWaveHeight: → real; ''' val depthInitModel = ''' @@ -219,12 +219,12 @@ class NablagenValidatorTest with BatiLib.*; with CartesianMesh2D.*; - let ℝ t = 0.0; - let ℝ maxTime = 0.1; - let ℕ maxIter = 500; - let ℝ δt = 1.0; - ℝ[2] X{nodes}; - ℝ η{cells}; + let real t = 0.0; + let real maxTime = 0.1; + let int maxIter = 500; + let real δt = 1.0; + real[2] X{nodes}; + real η{cells}; InitFromFile: ∀j∈cells(), η{j} = nextWaveHeight(); ''' diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UniqueNameValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UniqueNameValidatorTest.xtend index 1fa24b12c..c57024955 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UniqueNameValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UniqueNameValidatorTest.xtend @@ -40,7 +40,7 @@ class UniqueNameValidatorTest val rootKo = parseHelper.parse( ''' extension Test; - def f: ℕ × ℕ → ℕ, (a, a) → { return a; } + def f: int × int → int, (a, a) → { return a; } ''') Assert.assertNotNull(rootKo) rootKo.assertError(NablaPackage.eINSTANCE.arg, @@ -50,7 +50,7 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' extension Test; - def f: ℕ × ℕ → ℕ, (a, b) → { return a; } + def f: int × int → int, (a, b) → { return a; } ''') Assert.assertNotNull(rootOk) rootOk.assertNoErrors @@ -62,7 +62,7 @@ class UniqueNameValidatorTest val rootKo = parseHelper.parse( ''' «emptyTestModule» - ℝ a, a; + real a, a; ''') Assert.assertNotNull(rootKo) rootKo.assertError(NablaPackage.eINSTANCE.^var, @@ -72,7 +72,7 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; ''') Assert.assertNotNull(rootOk) rootOk.assertNoErrors @@ -84,8 +84,8 @@ class UniqueNameValidatorTest val rootKo = parseHelper.parse( ''' «emptyTestModule» - ℝ a; - ℝ a; + real a; + real a; ''') Assert.assertNotNull(rootKo) rootKo.assertError(NablaPackage.eINSTANCE.argOrVar, @@ -95,7 +95,7 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; ''') Assert.assertNotNull(rootOk) rootOk.assertNoErrors @@ -107,7 +107,7 @@ class UniqueNameValidatorTest val model = ''' «testModule» - ℝ XXX{nodes, nodes}; + real XXX{nodes, nodes}; ''' val rs = resourceSetProvider.get parseHelper.parse(readFileAsString(TestUtils.CartesianMesh2DPath), rs) @@ -124,7 +124,7 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' «model» - J1: ∀r1∈nodes(), ∀r2∈nodes(), let ℝ d = XXX{r1, r2} * 2.0; + J1: ∀r1∈nodes(), ∀r2∈nodes(), let real d = XXX{r1, r2} * 2.0; ''', rs) Assert.assertNotNull(rootOk) rootOk.assertNoErrors @@ -151,10 +151,10 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' «testModule» - ℝ X{nodes, nodes}; + real X{nodes, nodes}; J1: { set myNodes = nodes(); - ∀r1∈myNodes, ∀r2∈myNodes, let ℝ d = X{r1, r2} * 2.0; + ∀r1∈myNodes, ∀r2∈myNodes, let real d = X{r1, r2} * 2.0; } ''', rs) Assert.assertNotNull(rootOk) @@ -216,7 +216,7 @@ class UniqueNameValidatorTest val rootKo = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; IncrA: a = a + 1; IncrA: a = a + 1; ''') @@ -228,7 +228,7 @@ class UniqueNameValidatorTest val rootOk = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; IncrA: a = a + 1; ''') Assert.assertNotNull(rootOk) @@ -252,7 +252,7 @@ class UniqueNameValidatorTest val rootKo2 = parseHelper.parse( ''' «emptyTestModule» - ℕ n; + int n; iterate n while (true), m while (true); ''') Assert.assertNotNull(rootKo2) diff --git a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UnusedValidatorTest.xtend b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UnusedValidatorTest.xtend index 3ba54a336..e0be718e7 100644 --- a/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UnusedValidatorTest.xtend +++ b/tests/fr.cea.nabla.tests/src/fr/cea/nabla/tests/validation/UnusedValidatorTest.xtend @@ -51,7 +51,7 @@ class UnusedValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ u, v; + real u, v; iterate n while(true); ComputeU: u^{n+1} = u^{n} + 6.0; ''') @@ -65,7 +65,7 @@ class UnusedValidatorTest val moduleKo = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; ''') Assert.assertNotNull(moduleKo) @@ -76,7 +76,7 @@ class UnusedValidatorTest val moduleOk = parseHelper.parse( ''' «emptyTestModule» - ℝ a; + real a; ComputeA: a = 1.; ''') @@ -104,7 +104,7 @@ class UnusedValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - ℝ[2] X{nodes}; + real[2] X{nodes}; UpdateX: ∀r1∈nodes(), ∀r2∈topLeftNode(), X{r1} = X{r1} + 1; ''', rs) Assert.assertNotNull(moduleKo1) @@ -116,7 +116,7 @@ class UnusedValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - ℝ[2] X{nodes}; + real[2] X{nodes}; UpdateX: ∀r1∈nodes(), X{r1} = X{r1} + 1; ''', rs) Assert.assertNotNull(moduleOk) @@ -130,7 +130,7 @@ class UnusedValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - ℝ[2] X{nodes}; + real[2] X{nodes}; ''' val rs = resourceSetProvider.get parseHelper.parse(readFileAsString(TestUtils.CartesianMesh2DPath), rs) @@ -165,8 +165,8 @@ class UnusedValidatorTest val modelKo = ''' «emptyTestModule» - def f: x | ℝ[x] → ℝ, (a) → return 1.0; - let ℝ[2] orig = [0.0 , 0.0]; + def f: x | real[x] → real, (a) → return 1.0; + let real[2] orig = [0.0 , 0.0]; ''' val moduleKo = parseHelper.parse(modelKo) Assert.assertNotNull(moduleKo) @@ -180,7 +180,7 @@ class UnusedValidatorTest «modelKo» ComputeV: { - let ℝ v = f(orig); + let real v = f(orig); v = v + 1; } ''' @@ -196,9 +196,9 @@ class UnusedValidatorTest ''' «emptyTestModule» with CartesianMesh2D.*; - def sum, 0.0: ℝ[2], (a, b) → return a+b; - let ℝ[2] orig = [0.0 , 0.0]; - ℝ[2] X{nodes}; + def sum, 0.0: real[2], (a, b) → return a+b; + let real[2] orig = [0.0 , 0.0]; + real[2] X{nodes}; ''' val rs = resourceSetProvider.get parseHelper.parse(readFileAsString(TestUtils.CartesianMesh2DPath), rs)