Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private static void TestLoadCore <T>(string resourceName, NdArray <T> expected)
        {
            var actual = NpyFile.Load <T>(LoadTestResource(resourceName));

            Assert.Equal(expected, actual);
        }