robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1local t =require ( 'test.testutil' ) 2local n =require ( 'test.functional.testnvim' )() 3 4local describe , it , setup =t . describe , t . it , t . setup 5local eq =t . eq 6local eval =n . eval 7local clear =n . clear 8 9describe ( 'Division operator' , function () 10setup ( clear ) 11 12it ( 'returns infinity on {positive}/0.0' , function () 13eq ( "str2float('inf')" , eval ( 'string(1.0/0.0)' )) 14eq ( "str2float('inf')" , eval ( 'string(1.0e-100/0.0)' )) 15eq ( "str2float('inf')" , eval ( 'string(1.0e+100/0.0)' )) 16eq ( "str2float('inf')" , eval ( 'string((1.0/0.0)/0.0)' )) 17end ) 18 19it ( 'returns -infinity on {negative}/0.0' , function () 20eq ( "-str2float('inf')" , eval ( 'string((-1.0)/0.0)' )) 21eq ( "-str2float('inf')" , eval ( 'string((-1.0e-100)/0.0)' )) 22eq ( "-str2float('inf')" , eval ( 'string((-1.0e+100)/0.0)' )) 23eq ( "-str2float('inf')" , eval ( 'string((-1.0/0.0)/0.0)' )) 24end ) 25 26it ( 'returns NaN on 0.0/0.0' , function () 27eq ( "str2float('nan')" , eval ( 'string(0.0/0.0)' )) 28eq ( "str2float('nan')" , eval ( 'string(-(0.0/0.0))' )) 29eq ( "str2float('nan')" , eval ( 'string((-0.0)/0.0)' )) 30end ) 31end )