//! returns: 0
//! Test slice .delete() method.

@default fn main() -> i32 {
    let mut arr: [i32; 5] = [10, 20, 30, 40, 50];
    let mut s = &mut arr[..];

    // Delete middle element (index 2: value 30).
    s.delete(2);

    if s.len != 4 {
        return 1;
    }
    if s[0] != 10 {
        return 2;
    }
    if s[1] != 20 {
        return 3;
    }
    if s[2] != 40 {
        return 4;
    }
    if s[3] != 50 {
        return 5;
    }

    // Delete first element (index 0: value 10).
    s.delete(0);

    if s.len != 3 {
        return 6;
    }
    if s[0] != 20 {
        return 7;
    }
    if s[1] != 40 {
        return 8;
    }
    if s[2] != 50 {
        return 9;
    }

    // Delete last element (index 2: value 50).
    s.delete(2);

    if s.len != 2 {
        return 10;
    }
    if s[0] != 20 {
        return 11;
    }
    if s[1] != 40 {
        return 12;
    }

    // Cap should be unchanged.
    if s.cap != 5 {
        return 13;
    }
    return 0;
}
