Assertions in design by contract: Difference between revisions
→{{header|jq}}: library
(→{{header|jq}}: library) |
|||
Line 345:
=={{header|jq}}==
{{works with|jq}}
Line 367:
| (map(length) | add/length) as $result
# post-condition
| assert($result >= 0;
$__loc__ + { msg: "Average of absolute values should be non-negative."} )
| $result;
[1, 3], ["hello"]
| averageOfAbsolutes
</syntaxhighlight>
{{output}}
|