sizeof
doesn't return the number of elements in the array, it returns the memory size in bytes. Since your array contains three regular integers, and integers are 4 bytes in size, that's 3 * 4 == 12 bytes.
To get the length of the array, you have a few options:
Option 1
int size = sizeof(test) / sizeof(test[0]);
What that does is get the size of the array (which is 12 bytes) then divides that by the size of a single element (which is 4 bytes). Obviously 12 / 4 == 3.
Option 2
As pointed out by @PaulMcKenzie, if you're able to use C++17 you can use std::size. That makes it very easy because you can just do this:
int size = std::size(test);
Option 3 (Not recommended)
int size = *(&test + 1) - test;
Which is a clever hack using pointers, explained here. Will result in undefined behaviour and may break, depending on the compiler and its optimisations.