[
{
"name": "ten square metres of tiles in 1 square metre boxes with 10 percent waste",
"args": [
10,
1,
1,
1000
],
"expect": {
"areaToCover": 11,
"packs": 11,
"surplus": 0
}
},
{
"name": "8.64 square metres of 2.88 plasterboard is 3 sheets, not the 4 a float ceiling gives",
"args": [
8.64,
2.88,
1,
0
],
"expect": {
"areaToCover": 8.64,
"packs": 3,
"surplus": 0
}
},
{
"name": "2.1 over 0.3 is exactly 7 packs",
"args": [
2.1,
0.3,
1,
0
],
"expect": {
"areaToCover": 2.1,
"packs": 7,
"surplus": 0
}
},
{
"name": "two coats of paint on 42.5 square metres from 30 square metre tins",
"args": [
42.5,
30,
2,
0
],
"expect": {
"areaToCover": 85,
"packs": 3,
"surplus": 5
}
},
{
"name": "20 square metres of plasterboard with 10 percent waste",
"args": [
20,
2.88,
1,
1000
],
"expect": {
"areaToCover": 22,
"packs": 8,
"surplus": 1.04
}
},
{
"name": "flooring at 1.76 square metres a pack with 5 percent waste",
"args": [
14.3,
1.76,
1,
500
],
"expect": {
"areaToCover": 15.015,
"packs": 9,
"surplus": 0.825
}
},
{
"name": "one basis point of waste tips over into a second pack",
"args": [
1,
1,
1,
1
],
"expect": {
"areaToCover": 1.0001,
"packs": 2,
"surplus": 0.9999
}
},
{
"name": "area is taken to the square centimetre and the waste rounded up to it",
"args": [
0.33333,
0.5,
1,
333
],
"expect": {
"areaToCover": 0.3444,
"packs": 1,
"surplus": 0.1556
}
},
{
"name": "100 percent waste doubles the area",
"args": [
5,
3,
1,
10000
],
"expect": {
"areaToCover": 10,
"packs": 4,
"surplus": 2
}
},
{
"name": "an exact fit needs no spare",
"args": [
30,
30,
1,
0
],
"expect": {
"areaToCover": 30,
"packs": 1,
"surplus": 0
}
},
{
"name": "nothing to cover needs no packs",
"args": [
0,
2.5,
2,
1000
],
"expect": {
"areaToCover": 0,
"packs": 0,
"surplus": 0
}
},
{
"name": "zero coverage is an error",
"args": [
10,
0,
1,
0
],
"expectError": "coveragePerPack must be at least 0.0001 and at most 100000 square metres"
},
{
"name": "coverage below a square centimetre is an error",
"args": [
10,
4e-05,
1,
0
],
"expectError": "coveragePerPack must be at least 0.0001 and at most 100000 square metres"
},
{
"name": "a negative area is an error",
"args": [
-1,
1,
1,
0
],
"expectError": "areaSquareMetres must be a finite number from 0 to 1000000"
},
{
"name": "zero coats is an error",
"args": [
10,
1,
0,
0
],
"expectError": "coats must be a whole number from 1 to 10"
},
{
"name": "half a coat is an error",
"args": [
10,
1,
1.5,
0
],
"expectError": "coats must be a whole number from 1 to 10"
},
{
"name": "more than 100 percent waste is an error",
"args": [
10,
1,
1,
10001
],
"expectError": "wastageBasisPoints must be a whole number from 0 to 10000"
},
{
"name": "fractional basis points are an error",
"args": [
10,
1,
1,
2.5
],
"expectError": "wastageBasisPoints must be a whole number from 0 to 10000"
}
]