[
{"name": "£20,000 to raise £100,000: 20p per £1; £800,000 of £1m on charitable activities is 80%", "args": [{"minor": 2000000, "currency": "GBP"}, {"minor": 10000000, "currency": "GBP"}, {"minor": 80000000, "currency": "GBP"}, {"minor": 100000000, "currency": "GBP"}], "expect": {"costToRaiseOne": {"minor": 20, "currency": "GBP"}, "costRatioBasisPoints": 2000, "charitableSpendBasisPoints": 8000}},
{"name": "thirds round half up: 33.33p to 33p, 3333 bp; two thirds is 6667 bp", "args": [{"minor": 1, "currency": "GBP"}, {"minor": 3, "currency": "GBP"}, {"minor": 2, "currency": "GBP"}, {"minor": 3, "currency": "GBP"}], "expect": {"costToRaiseOne": {"minor": 33, "currency": "GBP"}, "costRatioBasisPoints": 3333, "charitableSpendBasisPoints": 6667}},
{"name": "an exact half rounds up: 12.5p per £1 is 13p", "args": [{"minor": 1, "currency": "GBP"}, {"minor": 8, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}, {"minor": 8, "currency": "GBP"}], "expect": {"costToRaiseOne": {"minor": 13, "currency": "GBP"}, "costRatioBasisPoints": 1250, "charitableSpendBasisPoints": 1250}},
{"name": "costs above income: £1.50 to raise £1", "args": [{"minor": 150000, "currency": "GBP"}, {"minor": 100000, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 150000, "currency": "GBP"}], "expect": {"costToRaiseOne": {"minor": 150, "currency": "GBP"}, "costRatioBasisPoints": 15000, "charitableSpendBasisPoints": 0}},
{"name": "no fundraising costs, all spending charitable", "args": [{"minor": 0, "currency": "GBP"}, {"minor": 500000, "currency": "GBP"}, {"minor": 700000, "currency": "GBP"}, {"minor": 700000, "currency": "GBP"}], "expect": {"costToRaiseOne": {"minor": 0, "currency": "GBP"}, "costRatioBasisPoints": 0, "charitableSpendBasisPoints": 10000}},
{"name": "yen have no minor unit: ¥0.3 to raise ¥1 rounds to ¥0, the basis points keep the detail", "args": [{"minor": 3000, "currency": "JPY"}, {"minor": 10000, "currency": "JPY"}, {"minor": 9000, "currency": "JPY"}, {"minor": 10000, "currency": "JPY"}], "expect": {"costToRaiseOne": {"minor": 0, "currency": "JPY"}, "costRatioBasisPoints": 3000, "charitableSpendBasisPoints": 9000}},
{"name": "three decimal places: 0.250 dinar to raise 1 dinar", "args": [{"minor": 250000, "currency": "KWD"}, {"minor": 1000000, "currency": "KWD"}, {"minor": 1, "currency": "KWD"}, {"minor": 2, "currency": "KWD"}], "expect": {"costToRaiseOne": {"minor": 250, "currency": "KWD"}, "costRatioBasisPoints": 2500, "charitableSpendBasisPoints": 5000}},
{"name": "zero funds raised is an error", "args": [{"minor": 100, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}], "expectError": "fundsRaised must be positive"},
{"name": "zero total expenditure is an error", "args": [{"minor": 100, "currency": "GBP"}, {"minor": 100, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}], "expectError": "totalExpenditure must be positive"},
{"name": "charitable spend above total expenditure is an error", "args": [{"minor": 100, "currency": "GBP"}, {"minor": 100, "currency": "GBP"}, {"minor": 11, "currency": "GBP"}, {"minor": 10, "currency": "GBP"}], "expectError": "charitableSpend of 11 is more than totalExpenditure of 10"},
{"name": "a negative cost is an error", "args": [{"minor": -1, "currency": "GBP"}, {"minor": 100, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}], "expectError": "fundraisingCosts must not be negative"},
{"name": "mixed currencies are an error", "args": [{"minor": 1, "currency": "GBP"}, {"minor": 100, "currency": "EUR"}, {"minor": 1, "currency": "GBP"}, {"minor": 1, "currency": "GBP"}], "expectError": "currency mismatch: EUR and GBP"}
]