74. Mutation: "Equation" を検証
方程式コードを検証するミューテーション。Equationエンジンは次の上に構築されています python 言語で、一般的な数学演算のサポートがあります。
サポートされている操作の一覧:
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。
Pythonのmathモジュール: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。
Python条件文:if、elif、else。
Pythonループ:for、while。
equationAsText は"""<equation>"""で囲まれ、コードはPython風のスタイルでなければなりません。
必要なタブと空白のみを保持してください。
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:
result = 35
elif calculated >= 20 and calculated < 30:
result = 25
else:
result = 15
"""
equationResultVariable: "result"
}) {
executed
result
errorMessage
}
}最終更新
役に立ちましたか?