void Fill_Random_Integer(int count) { TriangleTreeArray <int> arr = new TriangleTreeArray <int>(); int rows = arr.Rows; int cols = arr.Cols; for (int i = 0; i < count; i++) { arr[rand.Next(rows), rand.Next(cols)] = i; } }
void Iterator() { TriangleTreeArray <object> arr = new TriangleTreeArray <object>(); int rows = arr.Rows; int cols = arr.Cols; int count = 0; arr.Iterate(0, rows, 0, cols, true, (r, c, v) => { if (arr[r, c] != null) { count++; } return(true); }); }
void Fill_FullPage_Integer() { TriangleTreeArray <int> arr = new TriangleTreeArray <int>(); int rows = arr.Rows; int cols = arr.Cols; int s = 0; for (int x = 0; x < rows; x++) { for (int y = 0; y < cols; y += TriangleTreeArray <int> .ColSize) { arr[x, y] = s++; } } }
void ForEach_Full() { TriangleTreeArray <object> arr = new TriangleTreeArray <object>(); int rows = arr.Rows; int cols = arr.Cols; int count = 0; for (int r = 0; r < arr.Rows; r++) { for (int c = 0; c < arr.Cols; c++) { if (arr[r, c] != null) { count++; } } } }
void RW_Value_Check_1000x1000() { TriangleTreeArray <int> arr = new TriangleTreeArray <int>(); for (int r = 0; r < 1000; r++) { for (int c = 0; c < 1000; c++) { arr[r, c] = r * c; } } for (int r = 0; r < 1000; r++) { for (int c = 0; c < 1000; c++) { AssertEquals(arr[r, c], r * c); } } }