diff --git a/vlib/builtin/array_test.v b/vlib/builtin/array_test.v index 94091e163d..5524a2e110 100644 --- a/vlib/builtin/array_test.v +++ b/vlib/builtin/array_test.v @@ -21,6 +21,26 @@ fn test_pointer() { assert *d_arr[1][0] == 1 } +fn test_assign() { + arr := [2, 4, 8, 16, 32, 64, 128] + + arr[0] = 2 + arr[1] &= 255 + arr[2] |= 255 + arr[3] <<= 4 + arr[4] >>= 4 + arr[5] %= 5 + arr[6] ^= 3 + + assert arr[0] == 2 + assert arr[1] == 4 & 255 + assert arr[2] == 8 | 255 + assert arr[3] == 16 << 4 + assert arr[4] == 32 >> 4 + assert arr[5] == 64 % 5 + assert arr[6] == 128 ^ 3 +} + fn test_ints() { mut a := [1, 5, 2, 3] assert a.len == 4