3,217
edits
Changes
m
no edit summary
Logical tests feature (implemented in WPKG 0.9.6) allows nested checks:
<check type="logical" condition="or">
<check type="file" condition="exists" path="c:\fileA"/>
<check type="file" condition="exists" path="c:\fileB"/>
</check>
I.e. the outer check will return 'true' if either c:\fileA or c:\fileB exist. Nests within nests are acceptable.
New tests which have been added:
* not - returns the inverse of the nested check. Fails with an error if the number of nested checks is not one.
* and - returns the logical 'and' of all the nested checks. (See note below about lazy execution.)
* or - returns the logical 'or' of all the nested checks. (See note below about lazy execution.)
* atleast - returns true if at least value of the nested checks are true. (See note below about lazy execution.)
* atmost - returns true if no more than value of the nested checks are true. (See note below about lazy execution.)
N.B - this test uses 'lazy execution' meaning that if the logical condition is already determined by one of the sub-checks, the other sub-checks will not be performed. For example, we might want to check that c:\Program Files\Application exists and that c:\Program Files\Application\App.exe also exists. If a test finds that the directory doesn't exist, there's no way that the result of the logical 'and' can be true so it returns false immediately. In the above example (c:\fileA, c:\fileB), if c:\fileA exists no test is performed for c:\fileB. Likewise, if an 'at least' test requires four of eight tests to pass, the routine returns 'true' as soon as it finds a fourth true check whether or not it has attempted all of them.
[[category:Documentation]]
<check type="logical" condition="or">
<check type="file" condition="exists" path="c:\fileA"/>
<check type="file" condition="exists" path="c:\fileB"/>
</check>
I.e. the outer check will return 'true' if either c:\fileA or c:\fileB exist. Nests within nests are acceptable.
New tests which have been added:
* not - returns the inverse of the nested check. Fails with an error if the number of nested checks is not one.
* and - returns the logical 'and' of all the nested checks. (See note below about lazy execution.)
* or - returns the logical 'or' of all the nested checks. (See note below about lazy execution.)
* atleast - returns true if at least value of the nested checks are true. (See note below about lazy execution.)
* atmost - returns true if no more than value of the nested checks are true. (See note below about lazy execution.)
N.B - this test uses 'lazy execution' meaning that if the logical condition is already determined by one of the sub-checks, the other sub-checks will not be performed. For example, we might want to check that c:\Program Files\Application exists and that c:\Program Files\Application\App.exe also exists. If a test finds that the directory doesn't exist, there's no way that the result of the logical 'and' can be true so it returns false immediately. In the above example (c:\fileA, c:\fileB), if c:\fileA exists no test is performed for c:\fileB. Likewise, if an 'at least' test requires four of eight tests to pass, the routine returns 'true' as soon as it finds a fourth true check whether or not it has attempted all of them.
[[category:Documentation]]