Convert documented examples of predicate-arity
and function-arity
usage into assertEqualToResult-based unit tests
#220
Labels
Milestone
We have a series of documented examples showing how
predicate-arity
andfunction-arity
are used. We’d like to convert these examples into automated unit tests that use the!(assertEqualToResult ...)
form to verify outputs against expected results. This will help ensure that future changes do not break the documented behaviors.Examples to Convert:
Are found at https://github.com/trueagi-io/metta-wam/blob/master/prolog/metta_lang/stdlib_mettalog.metta#L100-L165
Testing
size-atom
as a predicate:(predicate-arity size-atom 2) ; Using `size-atom` forward: !(assertEqualToResult (match &dyn-space '(size-atom (a b c) $size) (The abc tuple was len $size)) ((The abc tuple was len 3))) ; Using `size-atom` in reverse (deduce a 4-element atom from size=4): !(assertEqualToResult (match &self (size-atom $new-atom 4) (The new atom is $new-atom)) ((The new atom is ($1 $2 $3 $4)))) etc
What We Need:
For each documented scenario, write a corresponding unit test that:
!(assertEqualToResult ...)
form.Ensure that the tests are stable. If a result might vary depending on internal logic, consider adjusting the test or using a known stable output scenario.
Why This Is Important:
Acceptance Criteria:
The text was updated successfully, but these errors were encountered: