blob: 3185590b7d2d7a8d02613e7ceb76b945a584cede [file] [log] [blame]
Check stepUp() and stepDown() bahevior for range type.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
function arguments are (min, max, step, value, [stepCount])
Using the default values
PASS stepUpExplicitBounds(null, null, null, "") is "51"
PASS stepDownExplicitBounds(null, null, null, "") is "49"
Non-number arguments (stepCount)
PASS stepUpExplicitBounds(null, null, null, "0", "0") is "0"
PASS stepDownExplicitBounds(null, null, null, "0", "0") is "0"
PASS stepUpExplicitBounds(null, null, null, "0", "foo") is "0"
PASS stepDownExplicitBounds(null, null, null, "0", "foo") is "0"
PASS stepUpExplicitBounds(null, null, null, "0", null) is "0"
PASS stepDownExplicitBounds(null, null, null, "0", null) is "0"
Normal cases
PASS stepUpExplicitBounds(null, null, null, "0") is "1"
PASS stepUpExplicitBounds(null, null, null, "1", 2) is "3"
PASS stepUpExplicitBounds(null, null, null, "3", -1) is "2"
PASS stepDownExplicitBounds("-100", null, null, "2") is "1"
PASS stepDownExplicitBounds("-100", null, null, "1", 2) is "-1"
PASS stepDownExplicitBounds("-100", null, null, "-1", -1) is "0"
Fractional cases
PASS stepUpExplicitBounds(-10, 10, 1, "0.1") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "0.2") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "1.0") is "2"
PASS stepUpExplicitBounds(-10, 10, 1, "1.1") is "2"
PASS stepUpExplicitBounds(-10, 10, 1, "1.2") is "2"
PASS stepUpExplicitBounds(-10, 10, 1, "2.0") is "3"
PASS stepUpExplicitBounds(-10, 10, 1, "-0.1") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "-0.2") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "-1.0") is "0"
PASS stepUpExplicitBounds(-10, 10, 1, "-1.1") is "0"
PASS stepUpExplicitBounds(-10, 10, 1, "-1.2") is "0"
PASS stepUpExplicitBounds(-10, 10, 1, "-2.0") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "0.1") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "0.2") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "1.0") is "0"
PASS stepDownExplicitBounds(-10, 10, 1, "1.1") is "0"
PASS stepDownExplicitBounds(-10, 10, 1, "1.2") is "0"
PASS stepDownExplicitBounds(-10, 10, 1, "2.0") is "1"
PASS stepDownExplicitBounds(-10, 10, 1, "-0.1") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "-0.2") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "-1.0") is "-2"
PASS stepDownExplicitBounds(-10, 10, 1, "-1.1") is "-2"
PASS stepDownExplicitBounds(-10, 10, 1, "-1.2") is "-2"
PASS stepDownExplicitBounds(-10, 10, 1, "-2.0") is "-3"
PASS stepUpExplicitBounds(-10, 10, 1, ".1") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, ".2") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "1.") is "2"
PASS stepUpExplicitBounds(-10, 10, 1, "2.") is "3"
PASS stepUpExplicitBounds(-10, 10, 1, "-.1") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "-.2") is "1"
PASS stepUpExplicitBounds(-10, 10, 1, "-1.") is "0"
PASS stepUpExplicitBounds(-10, 10, 1, "-2.") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, ".1") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, ".2") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "1.") is "0"
PASS stepDownExplicitBounds(-10, 10, 1, "2.") is "1"
PASS stepDownExplicitBounds(-10, 10, 1, "-.1") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "-.2") is "-1"
PASS stepDownExplicitBounds(-10, 10, 1, "-1.") is "-2"
PASS stepDownExplicitBounds(-10, 10, 1, "-2.") is "-3"
PASS stepUpExplicitBounds(-10, 10, .1, "0.1") is "0.2"
PASS stepUpExplicitBounds(-10, 10, .1, "0.2") is "0.3"
PASS stepUpExplicitBounds(-10, 10, .1, "1.0") is "1.1"
PASS stepUpExplicitBounds(-10, 10, .1, "1.1") is "1.2"
PASS stepUpExplicitBounds(-10, 10, .1, "1.2") is "1.3"
PASS stepUpExplicitBounds(-10, 10, .1, "2.0") is "2.1"
PASS stepUpExplicitBounds(-10, 10, .1, "-0.1") is "0"
PASS stepUpExplicitBounds(-10, 10, .1, "-0.2") is "-0.1"
PASS stepUpExplicitBounds(-10, 10, .1, "-1.0") is "-0.9"
PASS stepUpExplicitBounds(-10, 10, .1, "-1.1") is "-1"
PASS stepUpExplicitBounds(-10, 10, .1, "-1.2") is "-1.1"
PASS stepUpExplicitBounds(-10, 10, .1, "-2.0") is "-1.9"
PASS stepDownExplicitBounds(-10, 10, .1, "0.1") is "0"
PASS stepDownExplicitBounds(-10, 10, .1, "0.2") is "0.1"
PASS stepDownExplicitBounds(-10, 10, .1, "1.0") is "0.9"
PASS stepDownExplicitBounds(-10, 10, .1, "1.1") is "1"
PASS stepDownExplicitBounds(-10, 10, .1, "1.2") is "1.1"
PASS stepDownExplicitBounds(-10, 10, .1, "2.0") is "1.9"
PASS stepDownExplicitBounds(-10, 10, .1, "-0.1") is "-0.2"
PASS stepDownExplicitBounds(-10, 10, .1, "-0.2") is "-0.3"
PASS stepDownExplicitBounds(-10, 10, .1, "-1.0") is "-1.1"
PASS stepDownExplicitBounds(-10, 10, .1, "-1.1") is "-1.2"
PASS stepDownExplicitBounds(-10, 10, .1, "-1.2") is "-1.3"
PASS stepDownExplicitBounds(-10, 10, .1, "-2.0") is "-2.1"
PASS stepUpExplicitBounds(-10, 10, .1, ".1") is "0.2"
PASS stepUpExplicitBounds(-10, 10, .1, ".2") is "0.3"
PASS stepUpExplicitBounds(-10, 10, .1, "1.") is "1.1"
PASS stepUpExplicitBounds(-10, 10, .1, "2.") is "2.1"
PASS stepUpExplicitBounds(-10, 10, .1, "-.1") is "0"
PASS stepUpExplicitBounds(-10, 10, .1, "-.2") is "-0.1"
PASS stepUpExplicitBounds(-10, 10, .1, "-1.") is "-0.9"
PASS stepUpExplicitBounds(-10, 10, .1, "-2.") is "-1.9"
PASS stepDownExplicitBounds(-10, 10, .1, ".1") is "0"
PASS stepDownExplicitBounds(-10, 10, .1, ".2") is "0.1"
PASS stepDownExplicitBounds(-10, 10, .1, "1.") is "0.9"
PASS stepDownExplicitBounds(-10, 10, .1, "2.") is "1.9"
PASS stepDownExplicitBounds(-10, 10, .1, "-.1") is "-0.2"
PASS stepDownExplicitBounds(-10, 10, .1, "-.2") is "-0.3"
PASS stepDownExplicitBounds(-10, 10, .1, "-1.") is "-1.1"
PASS stepDownExplicitBounds(-10, 10, .1, "-2.") is "-2.1"
Extra arguments
PASS setInputAttributes(null, null, null, "0"); input.stepUp(1,2); input.value is "1"
PASS setInputAttributes(null, null, null, "1"); input.stepDown(1,3); input.value is "0"
Invalid step value
PASS stepUpExplicitBounds(null, null, "foo", "0") is "1"
PASS stepUpExplicitBounds(null, null, "0", "1") is "2"
PASS stepUpExplicitBounds(null, null, "-1", "2") is "3"
PASS stepDownExplicitBounds(null, null, "foo", "1") is "0"
PASS stepDownExplicitBounds(null, null, "0", "2") is "1"
PASS stepDownExplicitBounds(null, null, "-1", "3") is "2"
Step=any
PASS stepUpExplicitBounds(null, null, "any", "1") threw exception InvalidStateError: The object is in an invalid state..
PASS stepDownExplicitBounds(null, null, "any", "1") threw exception InvalidStateError: The object is in an invalid state..
Overflow/underflow
PASS stepUpExplicitBounds(null, "100", "1", "99") is "100"
PASS stepUpExplicitBounds(null, "100", "1", "100") threw exception InvalidStateError: The object is in an invalid state..
PASS input.value is "100"
PASS stepUpExplicitBounds(null, "100", "1", "99", "2") threw exception InvalidStateError: The object is in an invalid state..
PASS input.value is "99"
PASS stepDownExplicitBounds("0", null, "1", "1") is "0"
PASS stepDownExplicitBounds("0", null, "1", "0") threw exception InvalidStateError: The object is in an invalid state..
PASS input.value is "0"
PASS stepDownExplicitBounds("0", null, "1", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
PASS input.value is "1"
PASS stepDownExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
PASS stepUpExplicitBounds(-100, 0, 1, -1) is "0"
PASS stepUpExplicitBounds(null, 0, 1, 0) threw exception InvalidStateError: The object is in an invalid state..
PASS stepUpExplicitBounds(-100, 0, 1, -1, 2) threw exception InvalidStateError: The object is in an invalid state..
PASS input.value is "-1"
PASS stepUpExplicitBounds(null, null, "3.40282346e+38", "1", "2") threw exception InvalidStateError: The object is in an invalid state..
stepDown()/stepUp() for stepMismatch values
PASS stepUpExplicitBounds(null, null, 2, 1) is "4"
PASS input.stepDown(); input.value is "2"
PASS stepUpExplicitBounds(0, null, 10, 9, 9) is "100"
PASS stepDownExplicitBounds(0, null, 10, 19) is "10"
value + step is <= max, but rounded result would be > max.
PASS stepUpExplicitBounds(null, 99, 10, 89) threw exception InvalidStateError: The object is in an invalid state..
Huge value and small step
PASS stepUpExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
PASS stepDownExplicitBounds(0, 1e38, 1, 1e38, 999999) is "1e+38"
Fractional numbers
PASS stepUpExplicitBounds(null, null, 0.33333333333333333, 0, 3) is "1"
PASS stepUpExplicitBounds(null, null, 0.1, 1) is "1.1"
PASS stepUpExplicitBounds(null, null, 0.1, 1, 8) is "1.8"
PASS stepUpExplicitBounds(null, null, 0.1, 1, 10) is "2"
PASS input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.stepUp(); input.value is "3"
PASS stepUpExplicitBounds(0, 1, 0.003921568627450980, 0, 255) is "1"
PASS for (var i = 0; i < 255; i++) { input.stepDown(); }; input.value is "0"
PASS stepDownExplicitBounds(null, null, 0.1, 1, 8) is "0.2"
PASS stepDownExplicitBounds(null, null, 0.1, 1) is "0.9"
PASS successfullyParsed is true
TEST COMPLETE