basic tests. flatten implemented, but correctness not tested