niknaks.arrays (unittest)

- Added a unittest
This commit is contained in:
Tristan B. Velloza Kildaire 2024-04-27 16:49:57 +02:00
parent 6b12529ec3
commit c7825c5821
1 changed files with 13 additions and 0 deletions

View File

@ -469,4 +469,17 @@ unittest
public T[] removeResize(T)(T[] array, size_t position)
{
return array.shiftInto(position, false, true);
}
/**
* Tests removing an element from an array
*/
unittest
{
int[] numbas = [1, 5, 2];
numbas = numbas.removeResize(1);
// should now be [1, 2]
writeln(numbas);
assert(numbas == [1, 2]);
}