Functional Weave
Code in Python

money.sum@1.0.0

vectors.json

716 bytes · view raw

[
  { "name": "totals three lines", "args": [[{ "minor": 1000, "currency": "GBP" }, { "minor": 2550, "currency": "GBP" }, { "minor": 99, "currency": "GBP" }], "GBP"], "expect": { "minor": 3649, "currency": "GBP" } },
  { "name": "empty list is zero in the stated currency", "args": [[], "GBP"], "expect": { "minor": 0, "currency": "GBP" } },
  { "name": "credits reduce the total", "args": [[{ "minor": 5000, "currency": "GBP" }, { "minor": -1200, "currency": "GBP" }], "GBP"], "expect": { "minor": 3800, "currency": "GBP" } },
  { "name": "a foreign amount in the list is an error", "args": [[{ "minor": 100, "currency": "GBP" }, { "minor": 100, "currency": "USD" }], "GBP"], "expectError": "currency mismatch" }
]