74. Mutation : vérifier une "Equation"

Mutation pour vérifier le code de l'Équation. Le moteur Equation est construit sur python langage avec le support des opérations mathématiques courantes.

La liste des opérations prises en charge :

  1. module de base Python : abs, all, any, bin, bool, bytearray, bytes, chr, complex, dict, dir, divmod, enumerate, filter, float, format, frozenset, hash, hex, id, int, isinstance, len, list, map, max, min, oct, ord, pow, range, repr, reversed, round, set, slice, sorted, str, sum, tuple, type, zip.

  2. module math de Python : acos, acosh, asin, asinh, atan, atan2, atanh, ceil, copysign, cos, cosh, degrees, e, exp, fabs, factorial, floor, fmod, frexp, fsum, hypot, isinf, isnan, ldexp, log, log10, log1p, modf, pi, pow, radians, sin, sinh, sqrt, tan, tanh, trunc.

  3. conditions Python : if, elif, else.

  4. boucles Python : for, while.

triangle-exclamation
mutation VerifyEquation {
  verifyEquation(input: {
    dataVariables: [{
      variable: "yield_vol"
      sampleValue: 1.1 
    }, {
      variable: "prod"
      sampleValue: 2.2
    }]
    equationAsText: """calculated = yield_vol/prod + 3.5 
if calculated >= 30:
    resultat = 35
elif calculated >= 20 and calculated < 30:
    resultat = 25
sinon :
    resultat = 15
    """
    equationResultVariable: "result"
  }) {
    exécuté
    résultat
    message d'erreur
  }
}

Mis à jour

Ce contenu vous a-t-il été utile ?