Exemple #1
0
        public void TestArrayAndNormalItem()
        {
            var aa = new ArrayAnalyzer();
            // We get memory corruption if we create the tree and use it, rather
            // than writing it out to a file first. Not sure why... GC and other
            // things looked at, but they don't seem to be variables.
            {
                var f    = ROOTNET.NTFile.Open("TestArrayAndNormalItem.root", "RECREATE");
                var tree = CreateTrees.CreateTreeWithSimpleSingleVectorAndItem(20);
                f.Write();
                f.Close();
            }

            var f1    = ROOTNET.NTFile.Open("TestArrayAndNormalItem.root", "READ");
            var tree1 = f1.Get("dude") as ROOTNET.NTTree;

            ROOTClassShell sh = new ROOTClassShell();

            sh.Add(new Classitem()
            {
                ItemType = "int[]", Name = "myvectorofint"
            });
            var result = aa.DetermineAllArrayLengths(sh, tree1, 10);

            Assert.AreEqual(10, result.Length, "# of events");
            Assert.IsTrue(result.All(x => x.Length == 1), "incorrect individual variable list length list");
            Assert.IsTrue(result.All(x => x[0].Item2 == 10), "incorrect individual variable list length list");
            f1.Close();
        }
Exemple #2
0
        public void TestWithOneConstIndexedArray()
        {
            var aa = new ArrayAnalyzer();

            string filename = "TestWithOneConstIndexedArray.root";
            var    f        = new ROOTNET.NTFile(filename, "RECREATE");
            var    tree     = CreateTrees.CreateTreeWithConstIndexedSimpleVector(20);

            f.Write();

            ROOTClassShell sh = new ROOTClassShell();

            sh.Add(new Classitem()
            {
                ItemType = "int[]", Name = "arr"
            });
            var result = aa.DetermineAllArrayLengths(sh, tree, 10);

            Assert.AreEqual(10, result.Length, "# of events");
            Assert.IsTrue(result.All(x => x.Length == 1), "# of arrays");
            Assert.IsTrue(result.All(x => x[0].Item2 == 20), "Length of array");
            Assert.IsTrue(result.All(x => x[0].Item1 == "arr"), "variable name");

            f.Close();
        }
Exemple #3
0
        public void TestWithNoArrays()
        {
            var            aa      = new ArrayAnalyzer();
            var            tree    = CreateTrees.CreateWithIntOnly(10);
            ROOTClassShell sh      = new ROOTClassShell();
            var            results = aa.DetermineAllArrayLengths(sh, tree, 10);

            Assert.AreEqual(1, results.Length, "# of events incorrect");
            Assert.AreEqual(0, results[0].Length, "found an array!?");
        }
Exemple #4
0
        public void TestArrayWithNoEntries()
        {
            ArrayAnalyzer target = new ArrayAnalyzer(); // TODO: Initialize to an appropriate value

            var tree = CreateTrees.CreateVectorTree();

            ROOTClassShell sh = new ROOTClassShell();

            target.DetermineAllArrayLengths(sh, tree, 10);
        }