javascript - Test a function that takes 3 integers for all possible cases -
i have function takes in 3 integer numbers can anything.
the function performs complex comparisons on numbers , calls/returns accordingly.
var = 1; between +/- number.max_value var b = 2; var c = 3; result = thefunction(a,b,c);
i need test how logic in thefunction
holds possible values.
how test function possible values?
obviously can't plug in numbers , combinations of numbers!
what best amount of values (and be) can plug in , sure function work possible values??
without knowing more function, 1 can speak in generalities. common trouble cases @ , near boundaries of ranges. these include:
- maximum value
- minimum value
- maximum value - 1
- minimum value + 1
- -1, 0, , 1
add couple of positive , negative mid-range values, , have 9 or 10 numbers test each argument. 3 arguments, 1000 cases.
knowing internals of function may allow reduce cases or may suggest additional values or value combinations might sources of trouble.
p.s. due roundoff, number.max_value - 1
evaluates number.max_value
. should aiming largest representable number less number.max_value
. suggests couple of additional possible trouble spots: largest , smallest integers, according the docs are:
var biggestint = 9007199254740992; var smallestint = -9007199254740992;
Comments
Post a Comment