Produce more math errors in division

Besides dividing by zero, any result producing NaN including inf/inf, NaN/anything, anything/NaN causes a math error as well. We only contemplated NaN/anything and neglected the rest, so we generalize it.
This commit is contained in:
Sei Lisa 2016-05-15 18:21:24 +02:00
parent 28a8f0757c
commit 23b27bd3af
2 changed files with 7 additions and 3 deletions

View file

@ -493,6 +493,9 @@ def do_tests():
shouldexcept('div(1.0, 0.0)', ELSLMathError)
shouldexcept('div(1, 0)', ELSLMathError)
shouldexcept('div(NaN, 1)', ELSLMathError)
shouldexcept('div(1, NaN)', ELSLMathError)
shouldexcept('div(F32(1e40), F32(1e40))', ELSLMathError)
shouldexcept('zstr("blah")', ELSLInvalidType)
test(r'zstr(Key(u"xy\0zzy"))', Key(u'xy'))
test('typecast(Infinity, unicode)', u'Infinity')