module Main {
import Std::Array::Array;
import Std::Iter::Iter;
import Std::Test::Test;
import Std::Io::Io;

func Main() -> int {
    var arr: Array<int> = Array_New<int>(4);
    Array_Push<int>(&arr, 10);
    Array_Push<int>(&arr, 20);
    Array_Push<int>(&arr, 30);

    Test_AssertEqInt(Array_Len<int>(&arr) as int, 3);
    Test_AssertEqInt(Array_Get<int>(&arr, 0), 10);
    Test_AssertEqInt(Array_Get<int>(&arr, 1), 20);
    Test_AssertEqInt(Array_Get<int>(&arr, 2), 30);

    var it: Iter<int> = Array_Iter<int>(&arr);
    Test_AssertTrue(Iter_HasNext<int>(&it));
    Test_AssertEqInt(Iter_Next<int>(&it), 10);
    Test_AssertEqInt(Iter_Next<int>(&it), 20);
    Test_AssertEqInt(Iter_Next<int>(&it), 30);
    Test_AssertFalse(Iter_HasNext<int>(&it));

    var it2: Iter<int> = Array_Iter<int>(&arr);
    let count: uint = Iter_Count<int>(&it2);
    Test_AssertEqInt(count as int, 3);

    Print("All array+iter tests passed!");
    Array_Free<int>(&arr);
    return 0;
}
}
