[
{"name": "100 rooms over 30 nights, 2250 sold for 247,500.00", "args": [3000, 2250, {"minor": 24750000, "currency": "GBP"}], "expect": {"roomNightsAvailable": 3000, "roomNightsSold": 2250, "roomRevenue": {"minor": 24750000, "currency": "GBP"}, "occupancyBasisPoints": 7500, "adr": {"minor": 11000, "currency": "GBP"}, "revpar": {"minor": 8250, "currency": "GBP"}}},
{"name": "a full house: occupancy 100%, ADR equals RevPAR", "args": [50, 50, {"minor": 500000, "currency": "GBP"}], "expect": {"roomNightsAvailable": 50, "roomNightsSold": 50, "roomRevenue": {"minor": 500000, "currency": "GBP"}, "occupancyBasisPoints": 10000, "adr": {"minor": 10000, "currency": "GBP"}, "revpar": {"minor": 10000, "currency": "GBP"}}},
{"name": "nothing sold: ADR is undefined, not zero", "args": [30, 0, {"minor": 0, "currency": "GBP"}], "expect": {"roomNightsAvailable": 30, "roomNightsSold": 0, "roomRevenue": {"minor": 0, "currency": "GBP"}, "occupancyBasisPoints": 0, "adr": null, "revpar": {"minor": 0, "currency": "GBP"}}},
{"name": "one night of three sold rounds occupancy down to 3333", "args": [3, 1, {"minor": 9000, "currency": "GBP"}], "expect": {"roomNightsAvailable": 3, "roomNightsSold": 1, "roomRevenue": {"minor": 9000, "currency": "GBP"}, "occupancyBasisPoints": 3333, "adr": {"minor": 9000, "currency": "GBP"}, "revpar": {"minor": 3000, "currency": "GBP"}}},
{"name": "two nights of three sold rounds occupancy up to 6667", "args": [3, 2, {"minor": 20000, "currency": "GBP"}], "expect": {"roomNightsAvailable": 3, "roomNightsSold": 2, "roomRevenue": {"minor": 20000, "currency": "GBP"}, "occupancyBasisPoints": 6667, "adr": {"minor": 10000, "currency": "GBP"}, "revpar": {"minor": 6667, "currency": "GBP"}}},
{"name": "RevPAR rounds half-up from the totals: 4 over 8 room-nights is 0.5, so 1", "args": [8, 1, {"minor": 4, "currency": "GBP"}], "expect": {"roomNightsAvailable": 8, "roomNightsSold": 1, "roomRevenue": {"minor": 4, "currency": "GBP"}, "occupancyBasisPoints": 1250, "adr": {"minor": 4, "currency": "GBP"}, "revpar": {"minor": 1, "currency": "GBP"}}},
{"name": "ADR rounds half-up: 100.00 over 3 nights", "args": [7, 3, {"minor": 10000, "currency": "GBP"}], "expect": {"roomNightsAvailable": 7, "roomNightsSold": 3, "roomRevenue": {"minor": 10000, "currency": "GBP"}, "occupancyBasisPoints": 4286, "adr": {"minor": 3333, "currency": "GBP"}, "revpar": {"minor": 1429, "currency": "GBP"}}},
{"name": "RevPAR from the totals, not ADR x occupancy: 1000.01 over 3 of 5 room-nights", "args": [5, 3, {"minor": 100001, "currency": "GBP"}], "expect": {"roomNightsAvailable": 5, "roomNightsSold": 3, "roomRevenue": {"minor": 100001, "currency": "GBP"}, "occupancyBasisPoints": 6000, "adr": {"minor": 33334, "currency": "GBP"}, "revpar": {"minor": 20000, "currency": "GBP"}}},
{"name": "complimentary rooms sold for nothing", "args": [10, 5, {"minor": 0, "currency": "GBP"}], "expect": {"roomNightsAvailable": 10, "roomNightsSold": 5, "roomRevenue": {"minor": 0, "currency": "GBP"}, "occupancyBasisPoints": 5000, "adr": {"minor": 0, "currency": "GBP"}, "revpar": {"minor": 0, "currency": "GBP"}}},
{"name": "yen have no minor unit to round to", "args": [4, 3, {"minor": 55000, "currency": "JPY"}], "expect": {"roomNightsAvailable": 4, "roomNightsSold": 3, "roomRevenue": {"minor": 55000, "currency": "JPY"}, "occupancyBasisPoints": 7500, "adr": {"minor": 18333, "currency": "JPY"}, "revpar": {"minor": 13750, "currency": "JPY"}}},
{"name": "no rooms available is an error", "args": [0, 0, {"minor": 0, "currency": "GBP"}], "expectError": "roomNightsAvailable must be at least 1"},
{"name": "negative rooms sold is an error", "args": [10, -1, {"minor": 0, "currency": "GBP"}], "expectError": "roomNightsSold must not be negative"},
{"name": "selling more than is available is an error", "args": [10, 11, {"minor": 1000, "currency": "GBP"}], "expectError": "cannot exceed roomNightsAvailable"},
{"name": "negative revenue is an error", "args": [10, 5, {"minor": -100, "currency": "GBP"}], "expectError": "roomRevenue must not be negative"}
]