Skip to content
GitHub

Project

One spec, every language

Every Malagasy Address package implements the same specification, with data from a published source and shared test vectors, so a function gives the same answer in JavaScript and PHP.

The spec repository holds, for each module, the rules in plain words, the data with its source and the date it was checked, and the test vectors: inputs with the exact output or error code every port must produce.

malagasy-address-spec data, rules, Public API tables, test vectors
├─ malagasy-address-js includes the spec, generates its tables, runs every vector
└─ malagasy-address-php includes the spec, generates its tables, runs every vector
  • Tests are the contract. A port is complete when it passes every vector and provides every function of the Public API table.
  • Same error codes. INVALID_TYPE, INVALID_FORMAT, UNKNOWN_PLACE and OUT_OF_RANGE mean the same thing in every language.
  • A source for every value. The data comes from the OCHA COD-AB list. See Rules and sources.