whiley_test_file 0.6.2

An API for manipulating test files for the Whiley Programming Language.
Documentation
original.name="ConstrainedList_Valid_9"
======
>>> main.whiley
type posintlist is (int[] list) where all { i in 0 .. |list| | list[i] >= 0 }

function sum(posintlist ls, int i) -> (int r)
// Input i must be valid index in list, or one past
requires i >= 0 && i <= |ls|
// Return cannot be negative
ensures r >= 0:
    //
    if i == |ls|:
        return 0
    else:
        return ls[i] + sum(ls, i + 1)

function sum(posintlist ls) -> (int r)
ensures r >= 0:
    //
    return sum(ls, 0)

public export method test() :
    assume sum([1, 2, 3, 4, 5, 6, 7]) == 28

---