private static void TestSaveCore <T>(string expectedResourceName, NdArray <T> targetNdArray) { byte[] expected, actual; { var stream = LoadTestResource(expectedResourceName); expected = new byte[stream.Length]; stream.Read(expected, 0, expected.Length); } using (var stream = new MemoryStream()) { NpyFile.Save(stream, (dynamic)targetNdArray); stream.Seek(0, SeekOrigin.Begin); actual = new byte[stream.Length]; stream.Read(actual, 0, expected.Length); } Assert.Equal(expected, actual); }
private static void TestLoadCore <T>(string resourceName, NdArray <T> expected) { var actual = NpyFile.Load <T>(LoadTestResource(resourceName)); Assert.Equal(expected, actual); }