25.1 Test Restricted Growth Arrays

661aauxiliary 628+   (626 660 669 728)  628  665
local restrictedGrowthArrayTest(n: I, expected: List A): () == {
        import from A, Partition Integer;
        k: I := 0;
        for a in restrictedGrowthArrays n repeat k := next k;
        assertEquals(I, #expected, k);
        rga: Generator A := restrictedGrowthArrays n;
        for r in expected for a in rga repeat assertTrue equal?(r, a, n);
}

Uses Generator 617, I 47, Integer 66, and Partition 146.
661btest restricted growth array 661b  (660)  661c
testRestrictedGrowthArray1(): () == restrictedGrowthArrayTest(1, [[1]]);
661ctest restricted growth array 661b+   (660)  661b  662a
testRestrictedGrowthArray2(): () == restrictedGrowthArrayTest(2, [
        [1,0],
        [2,1]
    ]
);
662atest restricted growth array 661b+   (660)  661c  662b
testRestrictedGrowthArray3(): () == restrictedGrowthArrayTest(3, [
        [1,0,0],
        [2,0,1],
        [2,1,0],
        [2,1,1],
        [3,1,2]
    ]
);
662btest restricted growth array 661b+   (660)  662a  663
testRestrictedGrowthArray4(): () == restrictedGrowthArrayTest(4, [
        [1,0,0,0],
        [2,0,0,1],
        [2,0,1,0],
        [2,0,1,1],
        [3,0,1,2],
        [2,1,0,0],
        [2,1,0,1],
        [3,1,0,2],
        [2,1,1,0],
        [2,1,1,1],
        [3,1,1,2],
        [3,1,2,0],
        [3,1,2,1],
        [3,1,2,2],
        [4,1,2,3]
    ]
);
663test restricted growth array 661b+   (660)  662b
testRestrictedGrowthArray5(): () == restrictedGrowthArrayTest(5, [
        [1,0,0,0,0],
        [2,0,0,0,1],
        [2,0,0,1,0],
        [2,0,0,1,1],
        [3,0,0,1,2],
        [2,0,1,0,0],
        [2,0,1,0,1],
        [3,0,1,0,2],
        [2,0,1,1,0],
        [2,0,1,1,1],
        [3,0,1,1,2],
        [3,0,1,2,0],
        [3,0,1,2,1],
        [3,0,1,2,2],
        [4,0,1,2,3],
        [2,1,0,0,0],
        [2,1,0,0,1],
        [3,1,0,0,2],
        [2,1,0,1,0],
        [2,1,0,1,1],
        [3,1,0,1,2],
        [3,1,0,2,0],
        [3,1,0,2,1],
        [3,1,0,2,2],
        [4,1,0,2,3],
        [2,1,1,0,0],
        [2,1,1,0,1],
        [3,1,1,0,2],
        [2,1,1,1,0],
        [2,1,1,1,1],
        [3,1,1,1,2],
        [3,1,1,2,0],
        [3,1,1,2,1],
        [3,1,1,2,2],
        [4,1,1,2,3],
        [3,1,2,0,0],
        [3,1,2,0,1],
        [3,1,2,0,2],
        [4,1,2,0,3],
        [3,1,2,1,0],
        [3,1,2,1,1],
        [3,1,2,1,2],
        [4,1,2,1,3],
        [3,1,2,2,0],
        [3,1,2,2,1],
        [3,1,2,2,2],
        [4,1,2,2,3],
        [4,1,2,3,0],
        [4,1,2,3,1],
        [4,1,2,3,2],
        [4,1,2,3,3],
        [5,1,2,3,4]
    ]
);