whiley_test_file 0.6.2

An API for manipulating test files for the Whiley Programming Language.
Documentation
original.name="Coercion_Valid_16"
======
>>> main.whiley
type Element<T> is {Node<T>[] children}
type Node<T> is Element<T>|int[]

function count<T>(Node<T> n) -> int:
    if n is int[]:
        return 0
    else:
        int r = 1
        for i in 0..|n.children|:
            r = r + count(n.children[i])
        return r

public export method test():
    Node<int> n1 = []
    Node<int> n2 = {children:[]}
    Node<int> n3 = {children:[n1]}
    Node<int> n4 = {children:[n1,n2]}
    assume count(n1) == 0
    assume count(n2) == 1
    assume count(n3) == 1
    assume count(n4) == 2
---