Files
functional-programming-snake/fixtures/m11-pong-view.json
T

326 lines
6.1 KiB
JSON

{
"function": "pongView",
"cases": [
{
"name": "new-match",
"args": [
{
"ball": {
"x": 40,
"y": 25
},
"vel": {
"dx": 1,
"dy": 1
},
"player": 21,
"cpu": 21,
"held": {
"up": false,
"down": false
},
"score": {
"player": 0,
"cpu": 0
},
"status": "Playing",
"seed": 0,
"frame": 0
}
],
"expected": [
{
"tag": "Rect",
"x": 0,
"y": 0,
"w": 640,
"h": 400,
"color": "#111111"
},
{
"tag": "Rect",
"x": 16,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 616,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 320,
"y": 200,
"w": 8,
"h": 8,
"color": "#ffeb3b"
},
{
"tag": "Text",
"x": 320,
"y": 30,
"text": "0 0",
"color": "#ffffff",
"size": 24,
"align": "center"
}
]
},
{
"name": "paddles-and-ball-move-with-the-state",
"args": [
{
"ball": {
"x": 10,
"y": 5
},
"vel": {
"dx": 1,
"dy": 1
},
"player": 0,
"cpu": 42,
"held": {
"up": false,
"down": false
},
"score": {
"player": 3,
"cpu": 2
},
"status": "Playing",
"seed": 0,
"frame": 0
}
],
"expected": [
{
"tag": "Rect",
"x": 0,
"y": 0,
"w": 640,
"h": 400,
"color": "#111111"
},
{
"tag": "Rect",
"x": 16,
"y": 0,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 616,
"y": 336,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 80,
"y": 40,
"w": 8,
"h": 8,
"color": "#ffeb3b"
},
{
"tag": "Text",
"x": 320,
"y": 30,
"text": "3 2",
"color": "#ffffff",
"size": 24,
"align": "center"
}
]
},
{
"name": "player-wins",
"args": [
{
"ball": {
"x": 40,
"y": 25
},
"vel": {
"dx": 1,
"dy": 1
},
"player": 21,
"cpu": 21,
"held": {
"up": false,
"down": false
},
"score": {
"player": 5,
"cpu": 3
},
"status": "Over",
"seed": 0,
"frame": 0
}
],
"expected": [
{
"tag": "Rect",
"x": 0,
"y": 0,
"w": 640,
"h": 400,
"color": "#111111"
},
{
"tag": "Rect",
"x": 16,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 616,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 320,
"y": 200,
"w": 8,
"h": 8,
"color": "#ffeb3b"
},
{
"tag": "Text",
"x": 320,
"y": 30,
"text": "5 3",
"color": "#ffffff",
"size": 24,
"align": "center"
},
{
"tag": "Text",
"x": 320,
"y": 200,
"text": "You Win!",
"color": "#ffffff",
"size": 32,
"align": "center"
},
{
"tag": "Text",
"x": 320,
"y": 230,
"text": "Press R to restart",
"color": "#ffffff",
"size": 16,
"align": "center"
}
]
},
{
"name": "cpu-wins",
"args": [
{
"ball": {
"x": 40,
"y": 25
},
"vel": {
"dx": 1,
"dy": 1
},
"player": 21,
"cpu": 21,
"held": {
"up": false,
"down": false
},
"score": {
"player": 2,
"cpu": 5
},
"status": "Over",
"seed": 0,
"frame": 0
}
],
"expected": [
{
"tag": "Rect",
"x": 0,
"y": 0,
"w": 640,
"h": 400,
"color": "#111111"
},
{
"tag": "Rect",
"x": 16,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 616,
"y": 168,
"w": 8,
"h": 64,
"color": "#ffffff"
},
{
"tag": "Rect",
"x": 320,
"y": 200,
"w": 8,
"h": 8,
"color": "#ffeb3b"
},
{
"tag": "Text",
"x": 320,
"y": 30,
"text": "2 5",
"color": "#ffffff",
"size": 24,
"align": "center"
},
{
"tag": "Text",
"x": 320,
"y": 200,
"text": "CPU Wins",
"color": "#ffffff",
"size": 32,
"align": "center"
},
{
"tag": "Text",
"x": 320,
"y": 230,
"text": "Press R to restart",
"color": "#ffffff",
"size": 16,
"align": "center"
}
]
}
]
}