Files
functional-programming-snake/fixtures/m03-in-bounds.json
T
2026-10-28 23:41:34 +01:00

251 lines
4.4 KiB
JSON

{
"function": "inBounds",
"cases": [
{
"name": "top-left-corner",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 0,
"y": 0
}
],
"expected": true
},
{
"name": "bottom-right-corner",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 19,
"y": 19
}
],
"expected": true
},
{
"name": "x-negative",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": -1,
"y": 0
}
],
"expected": false
},
{
"name": "y-negative",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 0,
"y": -1
}
],
"expected": false
},
{
"name": "x-equals-width",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 20,
"y": 5
}
],
"expected": false
},
{
"name": "y-equals-height",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 5,
"y": 20
}
],
"expected": false
},
{
"name": "middle",
"args": [
{
"width": 20,
"height": 20,
"snake": [
{
"x": 2,
"y": 2
},
{
"x": 1,
"y": 2
},
{
"x": 0,
"y": 2
}
],
"dir": "Right",
"nextDir": "Right",
"apple": null,
"seed": 1,
"score": 0,
"status": "Playing",
"frame": 0
},
{
"x": 10,
"y": 10
}
],
"expected": true
}
]
}