void DontIgnoreNullAllValidIterate() { var arr = new Index4DArray <int>(); arr[0, 0] = 1; arr[0, 1] = 2; arr[0, 2] = 3; arr[1, 0] = 4; arr[1, 1] = 5; arr[1, 2] = 6; arr[2, 0] = 7; arr[2, 1] = 8; arr[2, 2] = 9; int count = 0, sum = 0; arr.Iterate(0, 0, 3, 3, false, (r, c, o) => { count++; sum += o; return(1); }); AssertEquals(count, 9); AssertEquals(sum, 45); }
void HalfValue_IgnoreNullIterate() { var arr = new Index4DArray <int?>(); arr[0, 0] = 1; arr[0, 1] = 2; arr[0, 2] = null; arr[1, 0] = null; arr[1, 1] = 5; arr[1, 2] = 6; arr[2, 0] = 7; arr[2, 1] = null; arr[2, 2] = 9; int count = 0, sum = 0; arr.Iterate(0, 0, 3, 3, true, (r, c, o) => { count++; sum += (int)o; return(1); }); AssertEquals(count, 6); AssertEquals(sum, 30); }