[
{
"name": "a 4 × 3 m lounge and a 2.5 × 2 m bedroom: 17 m², 182.99 sq ft",
"args": [
[
{
"name": "Lounge",
"length": "4",
"width": "3"
},
{
"name": "Bedroom",
"length": "2.5",
"width": "2"
}
],
"m",
2
],
"expect": {
"roomAreas": [
"12",
"5"
],
"total": "17",
"squareMetres": "17",
"squareFeet": "182.99"
}
},
{
"name": "decimal dimensions multiply exactly: 4.1 × 3.3 is 13.53, not 13.529999",
"args": [
[
{
"name": "Kitchen",
"length": "4.1",
"width": "3.3"
}
],
"m",
2
],
"expect": {
"roomAreas": [
"13.53"
],
"total": "13.53",
"squareMetres": "13.53",
"squareFeet": "145.64"
}
},
{
"name": "measured in feet: 12 × 10 and 15.5 × 11.25 is 294.375 sq ft, 27.35 m²",
"args": [
[
{
"name": "Bed 1",
"length": "12",
"width": "10"
},
{
"name": "Lounge",
"length": "15.5",
"width": "11.25"
}
],
"ft",
2
],
"expect": {
"roomAreas": [
"120",
"174.375"
],
"total": "294.375",
"squareMetres": "27.35",
"squareFeet": "294.38"
}
},
{
"name": "the same at 6 places keeps the exact square feet",
"args": [
[
{
"name": "Bed 1",
"length": "12",
"width": "10"
},
{
"name": "Lounge",
"length": "15.5",
"width": "11.25"
}
],
"ft",
6
],
"expect": {
"roomAreas": [
"120",
"174.375"
],
"total": "294.375",
"squareMetres": "27.348332",
"squareFeet": "294.375"
}
},
{
"name": "100 sq ft to whole square metres is 9",
"args": [
[
{
"name": "Office",
"length": "10",
"width": "10"
}
],
"ft",
0
],
"expect": {
"roomAreas": [
"100"
],
"total": "100",
"squareMetres": "9",
"squareFeet": "100"
}
},
{
"name": "100 sq ft to 4 places is 9.2903 m²",
"args": [
[
{
"name": "Office",
"length": "10",
"width": "10"
}
],
"ft",
4
],
"expect": {
"roomAreas": [
"100"
],
"total": "100",
"squareMetres": "9.2903",
"squareFeet": "100"
}
},
{
"name": "one square metre at 12 places: 10.76391041671 sq ft",
"args": [
[
{
"name": "Store",
"length": "1",
"width": "1"
}
],
"m",
12
],
"expect": {
"roomAreas": [
"1"
],
"total": "1",
"squareMetres": "1",
"squareFeet": "10.76391041671"
}
},
{
"name": "millimetre precision: 0.001 × 0.001 m is a square millimetre",
"args": [
[
{
"name": "Tile",
"length": "0.001",
"width": "0.001"
}
],
"m",
6
],
"expect": {
"roomAreas": [
"0.000001"
],
"total": "0.000001",
"squareMetres": "0.000001",
"squareFeet": "0.000011"
}
},
{
"name": "the largest room: 999.999 × 999.999 m",
"args": [
[
{
"name": "Warehouse",
"length": "999.999",
"width": "999.999"
}
],
"m",
0
],
"expect": {
"roomAreas": [
"999998.000001"
],
"total": "999998.000001",
"squareMetres": "999998",
"squareFeet": "10763889"
}
},
{
"name": "trailing zeros are accepted and dropped: 3.50 × 2.00",
"args": [
[
{
"name": "Bath",
"length": "3.50",
"width": "2.00"
}
],
"m",
2
],
"expect": {
"roomAreas": [
"7"
],
"total": "7",
"squareMetres": "7",
"squareFeet": "75.35"
}
},
{
"name": "no rooms is refused",
"args": [
[],
"m",
2
],
"expectError": "rooms must not be empty"
},
{
"name": "a zero dimension is refused",
"args": [
[
{
"name": "Cupboard",
"length": "0",
"width": "2"
}
],
"m",
2
],
"expectError": "room \"Cupboard\": length must be greater than zero"
},
{
"name": "four decimal places is refused",
"args": [
[
{
"name": "Hall",
"length": "1.2345",
"width": "2"
}
],
"m",
2
],
"expectError": "room \"Hall\": length must be a decimal below 1000"
},
{
"name": "1000 or more is refused",
"args": [
[
{
"name": "Field",
"length": "1000",
"width": "2"
}
],
"m",
2
],
"expectError": "room \"Field\": length must be a decimal below 1000"
},
{
"name": "feet and inches are not decimal feet",
"args": [
[
{
"name": "Hall",
"length": "10'6",
"width": "2"
}
],
"ft",
2
],
"expectError": "room \"Hall\": length must be a decimal below 1000"
},
{
"name": "a negative width is refused",
"args": [
[
{
"name": "Hall",
"length": "2",
"width": "-3"
}
],
"m",
2
],
"expectError": "room \"Hall\": width must be a decimal below 1000"
},
{
"name": "an unknown unit is refused",
"args": [
[
{
"name": "Hall",
"length": "2",
"width": "3"
}
],
"yd",
2
],
"expectError": "unknown length unit"
},
{
"name": "decimals beyond 12 are refused by units.convert",
"args": [
[
{
"name": "Hall",
"length": "2",
"width": "3"
}
],
"m",
13
],
"expectError": "decimals must be a whole number from 0 to 12"
},
{
"name": "a trailing newline is not part of a length",
"args": [
[
{
"name": "Hall",
"length": "4\n",
"width": "3"
}
],
"m",
2
],
"expectError": "room \"Hall\": length must be a decimal below 1000"
},
{
"name": "a trailing newline is not part of a width",
"args": [
[
{
"name": "Hall",
"length": "4",
"width": "3.5\n"
}
],
"m",
2
],
"expectError": "room \"Hall\": width must be a decimal below 1000"
}
]