-
Notifications
You must be signed in to change notification settings - Fork 0
Description
As an application developer integrating ucon
I want to define domain-specific units in TOML config files
So I can extend ucon at application startup without modifying library code or using global mutable state
Acceptance Criteria
-
GIVEN a valid TOML file with unit definitions
WHENload_package(path)is called
THEN a frozenUnitPackageobject must be returned. -
GIVEN a
UnitPackagewith unit definitions
WHENgraph.with_package(pkg)is called
THEN a new graph must be returned with those units registered. -
GIVEN a
UnitPackagewith edge definitions
WHENgraph.with_package(pkg)is called
THEN the new graph must have conversion edges for those definitions. -
GIVEN a unit defined in a package
WHENNumber(1, "custom_unit").to("base_unit")is called withinusing_graph(extended_graph)
THEN the conversion must succeed using the package-defined edge. -
GIVEN multiple packages
WHENgraph.with_package(a).with_package(b)is called
THEN units and edges from both packages must be available. -
GIVEN a package with an invalid dimension name
WHENload_package(path)is called
THENPackageLoadErrormust be raised with a descriptive message. -
GIVEN a package file that does not exist
WHENload_package(path)is called
THENPackageLoadErrormust be raised. -
GIVEN a package file with invalid TOML syntax
WHENload_package(path)is called
THENPackageLoadErrormust be raised with parse error details. -
GIVEN
graph.with_package(pkg)
WHEN the original graph is inspected
THEN it must be unchanged (immutable composition). -
GIVEN an extended graph
WHENset_default_graph(extended_graph)is called
THEN subsequent conversions must use the extended graph by default.