whiley_test_file 0.6.2

An API for manipulating test files for the Whiley Programming Language.
Documentation
original.name="While_Valid_24"
======
>>> main.whiley


function indexOf(int[] xs, int x) -> (int|null result)
// Either result is null, or gives the index of x in xs
ensures result is null || xs[result] == x:
    //
    int i = 0
    while i < |xs| where i >= 0:
        if xs[i] == x:
            return i
        i = i + 1
    return null

public export method test() :
    assume indexOf([1, 2, 3], 1) == 0
    assume indexOf([1, 2, 3], 0) == null

---