Skip to content

Add .any. test_diagnosis combinator #138

@bonachea

Description

@bonachea

Copied from BerkeleyLab/caffeine#251 :

 diag = .expect. (any(image_status == [0, PRIF_STAT_FAILED_IMAGE, PRIF_STAT_STOPPED_IMAGE])) & ! TODO: replace with .any. once Juliennes supports it
                        // "permitted image status"

IIUC, a failure of this test would not print out the failing image_status value, only a false .expect., which is not very useful.

I'm not very worried about this particular case, but I could imagine other situations arising where a result value is permitted to have one of several distinct expected values, and it would be nice for the diagnostic to include the actual value when that comparison fails to match any of the expected values.

Proposed syntax:

 diag = .any. (image_status .equalsExpected. [0, PRIF_STAT_FAILED_IMAGE, PRIF_STAT_STOPPED_IMAGE]) // "permitted image status"

where the diagnosis succeeds iff at least one of elements of .any. succeeds.
Otherwise, the diagnostic output should include the diagnostic strings generated from all of the failing conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions