[
{
"name": "a 5 by 4 metre slab 100 mm thick is 2 cubic metres",
"args": [
[
{
"kind": "slab",
"length": 5,
"width": 4,
"depth": 0.1,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
2
],
"cubicMetres": 2,
"orderCubicMetres": 2
}
},
{
"name": "a garage slab with 5 percent wastage orders up to the next tenth",
"args": [
[
{
"kind": "slab",
"length": 4.8,
"width": 3.6,
"depth": 0.15,
"diameter": null,
"height": null,
"count": 1
}
],
500
],
"expect": {
"elementCubicMetres": [
2.592
],
"cubicMetres": 2.592,
"orderCubicMetres": 2.8
}
},
{
"name": "a strip footing lands on half a litre and rounds half up",
"args": [
[
{
"kind": "strip-footing",
"length": 12.5,
"width": 0.6,
"depth": 0.225,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
1.688
],
"cubicMetres": 1.688,
"orderCubicMetres": 1.7
}
},
{
"name": "four identical pads",
"args": [
[
{
"kind": "pad",
"length": 1,
"width": 1,
"depth": 0.5,
"diameter": null,
"height": null,
"count": 4
}
],
0
],
"expect": {
"elementCubicMetres": [
2
],
"cubicMetres": 2,
"orderCubicMetres": 2
}
},
{
"name": "a 300 mm round column 3 m high",
"args": [
[
{
"kind": "column",
"length": null,
"width": null,
"depth": null,
"diameter": 0.3,
"height": 3,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
0.212
],
"cubicMetres": 0.212,
"orderCubicMetres": 0.3
}
},
{
"name": "a slab and four columns, with 10 percent wastage",
"args": [
[
{
"kind": "slab",
"length": 3,
"width": 3,
"depth": 0.1,
"diameter": null,
"height": null,
"count": 1
},
{
"kind": "column",
"length": null,
"width": null,
"depth": null,
"diameter": 0.25,
"height": 2.4,
"count": 4
}
],
1000
],
"expect": {
"elementCubicMetres": [
0.9,
0.471
],
"cubicMetres": 1.371,
"orderCubicMetres": 1.6
}
},
{
"name": "3 by 1 by 0.1 is 0.3 exactly, not the 0.4 a float ceiling orders",
"args": [
[
{
"kind": "slab",
"length": 3,
"width": 1,
"depth": 0.1,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
0.3
],
"cubicMetres": 0.3,
"orderCubicMetres": 0.3
}
},
{
"name": "exactly a tenth orders a tenth",
"args": [
[
{
"kind": "slab",
"length": 10,
"width": 1,
"depth": 0.01,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
0.1
],
"cubicMetres": 0.1,
"orderCubicMetres": 0.1
}
},
{
"name": "a litre over a tenth orders the next tenth",
"args": [
[
{
"kind": "slab",
"length": 1,
"width": 1,
"depth": 0.101,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
0.101
],
"cubicMetres": 0.101,
"orderCubicMetres": 0.2
}
},
{
"name": "dimensions are taken to the nearest millimetre",
"args": [
[
{
"kind": "slab",
"length": 2.0006,
"width": 1,
"depth": 1,
"diameter": null,
"height": null,
"count": 1
},
{
"kind": "slab",
"length": 2.0004,
"width": 1,
"depth": 1,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expect": {
"elementCubicMetres": [
2.001,
2
],
"cubicMetres": 4.001,
"orderCubicMetres": 4.1
}
},
{
"name": "100 percent wastage doubles the order",
"args": [
[
{
"kind": "pad",
"length": 0.6,
"width": 0.6,
"depth": 0.5,
"diameter": null,
"height": null,
"count": 3
}
],
10000
],
"expect": {
"elementCubicMetres": [
0.54
],
"cubicMetres": 0.54,
"orderCubicMetres": 1.1
}
},
{
"name": "an empty list is an error",
"args": [
[],
0
],
"expectError": "elements must not be empty"
},
{
"name": "a slab without a width is an error",
"args": [
[
{
"kind": "slab",
"length": 5,
"width": null,
"depth": 0.1,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expectError": "element 1: slab needs length, width and depth"
},
{
"name": "a column without a height is an error",
"args": [
[
{
"kind": "slab",
"length": 1,
"width": 1,
"depth": 0.1,
"diameter": null,
"height": null,
"count": 1
},
{
"kind": "column",
"length": null,
"width": null,
"depth": null,
"diameter": 0.3,
"height": null,
"count": 1
}
],
0
],
"expectError": "element 2: column needs diameter and height"
},
{
"name": "a negative depth is an error",
"args": [
[
{
"kind": "pad",
"length": 1,
"width": 1,
"depth": -0.2,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expectError": "element 1: depth must be a finite number greater than 0 and at most 1000 metres"
},
{
"name": "a dimension under half a millimetre is an error",
"args": [
[
{
"kind": "slab",
"length": 1,
"width": 1,
"depth": 0.0004,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expectError": "element 1: depth must be at least 1 millimetre"
},
{
"name": "a count of zero is an error",
"args": [
[
{
"kind": "pad",
"length": 1,
"width": 1,
"depth": 0.5,
"diameter": null,
"height": null,
"count": 0
}
],
0
],
"expectError": "element 1: count must be a whole number of at least 1"
},
{
"name": "negative wastage is an error",
"args": [
[
{
"kind": "pad",
"length": 1,
"width": 1,
"depth": 0.5,
"diameter": null,
"height": null,
"count": 1
}
],
-1
],
"expectError": "wastageBasisPoints must be a whole number from 0 to 10000"
},
{
"name": "a volume beyond 2^53 cubic millimetres is an error",
"args": [
[
{
"kind": "slab",
"length": 1000,
"width": 1000,
"depth": 1000,
"diameter": null,
"height": null,
"count": 1
}
],
0
],
"expectError": "the total volume is too large"
}
]