view tests/mini/arrays16.d @ 1185:8baf611f0009

Fix nested references to 'ref' foreach variables. These "walk around" the array being iterated over, so they're a bit trickier than other variables to get right.
author Frits van Bommel <fvbommel wxs.nl>
date Wed, 01 Apr 2009 00:01:44 +0200
parents 23538d0f0d5b
children
line wrap: on
line source

module mini.arrays16;

void main()
{
    intarrays!(byte)();
    intarrays!(ubyte)();
    intarrays!(short)();
    intarrays!(ushort)();
    intarrays!(int)();
    intarrays!(uint)();
    intarrays!(long)();
    intarrays!(ulong)();
}

void intarrays(T)()
{
    T[] ia = [cast(T)1,2,3,4];
    T[] ib = [cast(T)1,2,3,4];
    T[] ic = [cast(T)1,2,3];
    T[] id = [cast(T)1,2,3,4,5];

    assert(ia == ia);
    assert(ia == ib);
    assert(ia != ic);
    assert(ia != id);
    assert(ia > ic);
    assert(ia !< ic);
    assert(ia < id);
    assert(ia !> id);
}