Ejemplo n.º 1
0
        public void NestsGroups()
        {
            using (var file = new H5File(TEST_FILE))
            {
                file.AddGroup("out").AddGroup("mid").AddGroup("in");

                Assert.AreEqual(1, file.Groups.Count());
                var o = file.Groups.First();
                Assert.AreEqual("out", o.Name);
                Assert.AreEqual(1, o.Groups.Count());
                var m = o.Groups.First();
                Assert.AreEqual("mid", m.Name);
                Assert.AreEqual(1, m.Groups.Count());
                var i = m.Groups.First();
                Assert.AreEqual("in", i.Name);
                Assert.AreEqual(0, i.Groups.Count());
            }
        }
Ejemplo n.º 2
0
 public void PropertyShouldReturnSameObject()
 {
     using (var file = new H5File(TEST_FILE))
     {
         var g1 = file.AddGroup("group");
         var g2 = file.Groups.First();
         var g3 = file.Groups.First();
         Assert.IsTrue(g1 == g2 && g2 == g3);
     }
 }
Ejemplo n.º 3
0
 public void ObjectsWithSamePathShouldBeEqual()
 {
     using (var file = new H5File(TEST_FILE))
     {
         var group = file.AddGroup("group");
         Assert.AreEqual(group, file.Groups.First());
     }
 }
Ejemplo n.º 4
0
        public void SimpleGroupCreateFind()
        {
            using (var file = new H5File(TEST_FILE))
            {
                file.AddGroup("simple");
            }

            using (var file = new H5File(TEST_FILE))
            {
                Assert.AreEqual(1, file.Groups.Count());

                var group = file.Groups.First();
                Assert.AreEqual("simple", group.Name);
                Assert.AreEqual(0, group.Groups.Count());
            }
        }
Ejemplo n.º 5
0
        public void SimpleAttributeCreateFind()
        {
            var attributes = new Dictionary<string, object>()
                {
                    {"attr1", "hello world!"},
                    {"attr2", 15.6},
                    {"attr3", new[] {3, 2, 1}}
                };

            using (var file = new H5File(TEST_FILE))
            {
                var group = file.AddGroup("simple");

                foreach (var kv in attributes)
                {
                    group.Attributes[kv.Key] = new H5Attribute(kv.Value);
                }
            }

            using (var file = new H5File(TEST_FILE))
            {
                Assert.AreEqual(1, file.Groups.Count());

                var group = file.Groups.First();
                var actual = group.Attributes.ToDictionary(a => a.Name, a => a.GetValue());

                Assert.AreEqual(attributes, actual);
            }
        }
Ejemplo n.º 6
0
        public void ShouldDeleteGroup()
        {
            using (var file = new H5File(TEST_FILE))
            {
                var group = file.AddGroup("group");
                group.Delete();
                Assert.AreEqual(0, file.Groups.Count());
            }

            using (var file = new H5File(TEST_FILE))
            {
                Assert.AreEqual(0, file.Groups.Count());
            }
        }