The simple-linked-list exercise is implemented in 31 tracks … but there is no canonical data. However, looking through the tests on those tracks, I saw quite a bit of overlap and common tests.
I propose to add following canonical data to to the problem specs.
Due to size limits, I need to split it across posts ![]()
For easier reading, I also attached a rendered-code version (below).
Proposed cases, JSON, part 1/2
{
"cases": [
{
"description": "count",
"cases": [
{
"uuid": "TBD",
"description": "Empty list has length of zero",
"property": "list",
"input": {
"initialValues": [],
"operations": [
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Singleton list has length of one",
"property": "list",
"input": {
"initialValues": [1],
"operations": [
{
"operation": "count",
"expected": 1
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Non-empty list has correct length",
"property": "list",
"input": {
"initialValues": [1, 2,3 ],
"operations": [
{
"operation": "count",
"expected": 3
}
]
},
"expected": {}
}
]
},
{
"description": "pop",
"cases": [
{
"uuid": "TBD",
"description": "Pop from empty list is an error",
"property": "list",
"input": {
"initialValues": [],
"operations": [
{
"operation": "pop",
"expected": {
"error": "list is empty"
}
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can pop from singleton list",
"property": "list",
"input": {
"initialValues": [1],
"operations": [
{
"operation": "pop",
"expected": 1
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can pop from non-empty list",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "pop",
"expected": 2
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can pop multiple items",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "pop",
"expected": 2
},
{
"operation": "pop",
"expected": 1
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Pop updates the count",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "count",
"expected": 2
},
{
"operation": "pop",
"expected": 2
},
{
"operation": "count",
"expected": 1
},
{
"operation": "pop",
"expected": 1
},
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
}
]
},
{
"description": "push",
"cases": [
{
"uuid": "TBD",
"description": "Can push to an empty list",
"property": "list",
"input": {
"operations": [
{
"operation": "push",
"value": 1
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can push to a non-empty list",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "push",
"value": 3
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Push updates count",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "push",
"value": 3
},
{
"operation": "count",
"expected": 3
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Push and pop",
"property": "list",
"input": {
"initialValues": [],
"operations": [
{
"operation": "push",
"value": 1
},
{
"operation": "push",
"value": 2
},
{
"operation": "pop",
"expected": 2
},
{
"operation": "push",
"value": 3
},
{
"operation": "count",
"expected": 2
},
{
"operation": "pop",
"expected": 3
},
{
"operation": "pop",
"expected": 1
},
{
"operation": "count",
"expected": 0
}
]
},
"expected": {}
}
]
},
{
"description": "peek",
"cases": [
{
"uuid": "TBD",
"description": "Peek on empty list is an error",
"property": "list",
"input": {
"initialValues": [],
"operations": [
{
"operation": "peek",
"expected": {
"error": "list is empty"
}
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can peek on singleton list",
"property": "list",
"input": {
"initialValues": [1],
"operations": [
{
"operation": "peek",
"expected": 1
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can peek on non-empty list",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "peek",
"expected": 2
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Peek does not change the count",
"property": "list",
"input": {
"initialValues": [1, 2],
"operations": [
{
"operation": "peek",
"expected": 2
},
{
"operation": "count",
"expected": 2
}
]
},
"expected": {}
},
{
"uuid": "TBD",
"description": "Can peek after a pop and push",
"property": "list",
"input": {
"initialValues": [],
"operations": [
{
"operation": "push",
"value": 1
},
{
"operation": "push",
"value": 2
},
{
"operation": "peek",
"expected": 2
},
{
"operation": "pop",
"value": 2
},
{
"operation": "peek",
"expected": 1
},
{
"operation": "push",
"value": 3
},
{
"operation": "peek",
"expected": 3
}
]
},
"expected": {}
}
]
},
[...]