Skip to content

Commit b06325e

Browse files
Rational Numbers: add error test case to expreal property
1 parent 20849dc commit b06325e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

exercises/rational-numbers/canonical-data.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,28 @@
400400
"r": [0, 1]
401401
},
402402
"expected": 1.0
403+
},
404+
{
405+
"uuid": "da137f1c-fc94-4035-9813-94f5152a1102",
406+
"description": "Raise a negative real number to a rational number with an even numerator",
407+
"property": "expreal",
408+
"input": {
409+
"x": -1,
410+
"r": [2, 2]
411+
},
412+
"expected": 1.0
413+
},
414+
{
415+
"uuid": "f3734f78-91b2-4e59-905e-8c61dbf34f39",
416+
"description": "Fails with a negative base if the numerator of the exponent is odd",
417+
"property": "expreal",
418+
"input": {
419+
"x": -1,
420+
"r": [1, 2]
421+
},
422+
"expected": {
423+
"error": "impossible operation"
424+
}
403425
}
404426
]
405427
},

0 commit comments

Comments
 (0)