#!/usr/bin/env qore

%requires ../../../../qlib/Util.qm
%requires ../../../../qlib/QUnit.qm

%new-style
%require-types
%enable-all-warnings

%exec-class ZipTest

public class ZipTest inherits QUnit::Test {
    constructor() : Test ("ZipTest", "1.0") {
        addTestCase ("Tests for zip() function", \test_zip());
        set_return_value(main());
    }

    test_zip() {
        list l1 = (1, 2, 3);
        list l2 = (4, 5, 6, 7);
        list l3 = (8, 9);

        # zip 3 lists
        assertEq (((1,4,8), (2,5,9), (3,6,NOTHING), (NOTHING,7,NOTHING)), zip (l1, l2, l3));
        # zip 2 lists
        assertEq (((1,4), (2,5), (3,6), (NOTHING,7)), zip (l1, l2));
        # zip 1 list
        assertEq (((1,), (2,), (3,)), zip (l1));
        # zip 0 lists
        assertEq ((), zip ());
    }
}
