Example #1
0
    void TestInsert()
    {
        print("Testing insert/add");
        SmartDynarray hundreds = new SmartDynarray(0);

        DebugPrintSmartDynarray(hundreds);
        hundreds.Insert(0, 100);
        hundreds.Insert(1, 200);
        hundreds.Add(300);
        hundreds.Add(400);
        DebugPrintSmartDynarray(hundreds);
        print("inserts/adds at end - expected [ 100 200 300 400 ]");
        hundreds.Insert(0, 500);
        DebugPrintSmartDynarray(hundreds);
        print("insert at start - expected [ 500 100 200 300 400 ]");
        hundreds.Insert(1, 800);
        DebugPrintSmartDynarray(hundreds);
        print("insert in middle - expected [ 500 800 100 200 300 400 ]");
    }
Example #2
0
    SmartDynarray DebugCreateLittleArray()
    {
        // 0 5 10 15 20
        var d = new SmartDynarray(0);

        for (int i = 0; i < 5; i++)
        {
            d.Add(i * 5);
        }
        return(d);
    }