pimatic
Version:
A home automation server and framework for the Raspberry PI running on node.js
253 lines (243 loc) • 6.75 kB
JSON
[
{
"description": "multipleOf",
"schema": {
"type": "integer",
"multipleOf": 8
},
"tests": [
{
"description": "integer matches schema",
"data": 64,
"valid": true
},
{
"description": "integer does not match schema",
"data": 65,
"valid": false
}
]
},
{
"description": "multipleOf for non-integer numbers",
"schema": {
"type": "number",
"multipleOf": 42.1
},
"tests": [
{
"description": "number matches schema",
"data": 84.2,
"valid": true
},
{
"description": "number does not match schema",
"data": 84.3,
"valid": false
}
]
},
{
"description": "maximum",
"schema": {
"type": "number",
"maximum": 42
},
"tests": [
{
"description": "negative integer matches schema",
"data": -100,
"valid": true
},
{
"description": "zero integer matches schema",
"data": 0,
"valid": true
},
{
"description": "max value integer matches schema",
"data": 42,
"valid": true
},
{
"description": "max value float matches schema",
"data": 42.0,
"valid": true
},
{
"description": "over-value number does not match schema",
"data": 43,
"valid": false
},
{
"description": "large number does not match schema",
"data": 999,
"valid": false
}
]
},
{
"description": "maximum with exclusiveMaximum",
"schema": {
"type": "number",
"maximum": 42,
"exclusiveMaximum": true
},
"tests": [
{
"description": "negative integer matches schema",
"data": -100,
"valid": true
},
{
"description": "zero integer matches schema",
"data": 0,
"valid": true
},
{
"description": "integer matches schema",
"data": 41,
"valid": true
},
{
"description": "float matches schema",
"data": 41.0,
"valid": true
},
{
"description": "max value integer does not match schema",
"data": 42,
"valid": false
},
{
"description": "max value float does not match schema",
"data": 42.0,
"valid": false
},
{
"description": "over-value number does not match schema",
"data": 43,
"valid": false
}
]
},
{
"description": "maximum with exclusiveMaximum set to false should behave correctly",
"schema": {
"type": "number",
"maximum": 42,
"exclusiveMaximum": false
},
"tests": [
{
"description": "max value integer matches schema",
"data": 42,
"valid": true
},
{
"description": "max value float matches schema",
"data": 42.0,
"valid": true
},
{
"description": "over-value number does not match schema",
"data": 43,
"valid": false
}
]
},
{
"description": "minimum",
"schema": {
"type": "number",
"minimum": 42
},
"tests": [
{
"description": "min value integer matches schema",
"data": 42,
"valid": true
},
{
"description": "min value float matches schema",
"data": 42.0,
"valid": true
},
{
"description": "large number matches schema",
"data": 999,
"valid": true
},
{
"description": "zero does not match schema",
"data": 0,
"valid": false
},
{
"description": "negative number does not match schema",
"data": -999,
"valid": false
}
]
},
{
"description": "minimum with exclusiveMinimum",
"schema": {
"type": "number",
"minimum": 42,
"exclusiveMinimum": true
},
"tests": [
{
"description": "min value integer does not match schema",
"data": 42,
"valid": false
},
{
"description": "min value float does not match schema",
"data": 42.0,
"valid": false
},
{
"description": "large number matches schema",
"data": 999,
"valid": true
},
{
"description": "zero does not match schema",
"data": 0,
"valid": false
},
{
"description": "negative number does not match schema",
"data": -999,
"valid": false
}
]
},
{
"description": "minimum with exclusiveMinimum set to false should behave correctly",
"schema": {
"type": "number",
"minimum": 42,
"exclusiveMinimum": false
},
"tests": [
{
"description": "min value integer matches schema",
"data": 42,
"valid": true
},
{
"description": "min value float matches schema",
"data": 42.0,
"valid": true
},
{
"description": "under-value number does not match schema",
"data": -999,
"valid": false
}
]
}
]