@@ -299,6 +299,18 @@ suite('Calculation', function() {
299299 result = mockP5Prototype . max ( [ 10 , 10 ] ) ;
300300 assert . equal ( result , 10 ) ;
301301 } ) ;
302+ test ( 'should handle Infinity' , function ( ) {
303+ result = mockP5Prototype . max ( 3 , Infinity ) ;
304+ assert . equal ( result , Infinity ) ;
305+ } ) ;
306+ test ( 'should handle -Infinity' , function ( ) {
307+ result = mockP5Prototype . max ( 3 , - Infinity ) ;
308+ assert . equal ( result , 3 ) ;
309+ } ) ;
310+ test ( 'should handle Infinity in array' , function ( ) {
311+ result = mockP5Prototype . max ( [ 3 , Infinity , 5 ] ) ;
312+ assert . equal ( result , Infinity ) ;
313+ } ) ;
302314 } ) ;
303315
304316 suite ( 'p5.prototype.min' , function ( ) {
@@ -331,6 +343,18 @@ suite('Calculation', function() {
331343 result = mockP5Prototype . min ( [ 10 , 10 ] ) ;
332344 assert . equal ( result , 10 ) ;
333345 } ) ;
346+ test ( 'should handle Infinity' , function ( ) {
347+ result = mockP5Prototype . min ( Infinity , 3 ) ;
348+ assert . equal ( result , 3 ) ;
349+ } ) ;
350+ test ( 'should handle -Infinity' , function ( ) {
351+ result = mockP5Prototype . min ( 3 , - Infinity ) ;
352+ assert . equal ( result , - Infinity ) ;
353+ } ) ;
354+ test ( 'should handle -Infinity in array' , function ( ) {
355+ result = mockP5Prototype . min ( [ 3 , - Infinity , 5 ] ) ;
356+ assert . equal ( result , - Infinity ) ;
357+ } ) ;
334358 } ) ;
335359
336360 suite ( 'p5.prototype.norm' , function ( ) {
0 commit comments