public void TestReadAndWrite() { // Define variables and constants const int NUM_ALLOCS = 200; AlignedAllocation <Matrix>[] allocs = new AlignedAllocation <Matrix> [NUM_ALLOCS]; // Set up context for (int i = 0; i < allocs.Length; i++) { allocs[i] = new AlignedAllocation <Matrix>(16L); } // Execute for (int i = 0; i < allocs.Length; i++) { allocs[i].Write(new Matrix( i, i * 2, i * 3, i * 4, i * 11, i * 12, i * 13, i * 14, i * 21, i * 22, i * 23, i * 24, i * 31, i * 32, i * 33, i * 34 )); } // Assert outcome for (int i = 0; i < allocs.Length; i++) { Assert.AreEqual(new Matrix( i, i * 2, i * 3, i * 4, i * 11, i * 12, i * 13, i * 14, i * 21, i * 22, i * 23, i * 24, i * 31, i * 32, i * 33, i * 34 ), allocs[i]); } allocs.ForEach(alloc => alloc.Dispose()); }