From c7825c5821c068d72ef0e8f1d49f3106e6a572eb Mon Sep 17 00:00:00 2001 From: Tristan Brice Velloza Kildaire Date: Sat, 27 Apr 2024 16:49:57 +0200 Subject: [PATCH] niknaks.arrays (unittest) - Added a unittest --- source/niknaks/arrays.d | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/niknaks/arrays.d b/source/niknaks/arrays.d index 039b3d4..1b2a493 100644 --- a/source/niknaks/arrays.d +++ b/source/niknaks/arrays.d @@ -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]); } \ No newline at end of file