Assertions in design by contract: Difference between revisions

Line 345:
 
=={{header|jq}}==
{{Library|Uses: https://rosettacode.org/wiki/Category:jq-assert}}
{{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."} )
$__loc__ + { msg: "Average of absolute values should be non-negative."} )
| $result;
 
[1, 3], ["hello"]
| averageOfAbsolutes
 
</syntaxhighlight>
{{output}}
2,458

edits