Exemplo n.º 1
0
        public void TestGetProperties()
        {
            // s1.p11 = s0.p01 and s0.p02 = s1.p12
            queryGraph.AddStrictEquals(1, "P11", Make(1, "P11"), 0, "P01", Make(0, "P01"));
            queryGraph.AddStrictEquals(0, "P02", Make(0, "P02"), 1, "P12", Make(1, "P12"));
            log.Debug(queryGraph.ToString());

            string[] expectedOne = new string[] { "P11", "P12" };
            string[] expectedTwo = new string[] { "P01", "P02" };
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 1, 0)));
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 1)));
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 1, 0)));
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 1)));
        }
Exemplo n.º 2
0
        public void TestFillEquivalency()
        {
            // test with just 3 streams
            queryGraph.AddStrictEquals(0, "P00", Make(0, "P00"), 1, "P10", Make(1, "P10"));
            queryGraph.AddStrictEquals(1, "P10", Make(1, "P10"), 2, "P20", Make(2, "P20"));

            Assert.IsFalse(queryGraph.IsNavigableAtAll(0, 2));
            Assert.AreEqual(0, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 2).Length);
            Assert.AreEqual(0, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 2).Length);

            QueryGraphForge.FillEquivalentNav(types, queryGraph);

            Assert.IsTrue(queryGraph.IsNavigableAtAll(0, 2));
            string[] expectedOne = new string[] { "P00" };
            string[] expectedTwo = new string[] { "P20" };
            Assert.IsTrue(Arrays.AreEqual(expectedOne, SupportQueryGraphTestUtil.GetStrictKeyProperties(queryGraph, 0, 2)));
            Assert.IsTrue(Arrays.AreEqual(expectedTwo, SupportQueryGraphTestUtil.GetIndexProperties(queryGraph, 0, 2)));

            // test with 5 streams, connect all streams to all streams
            queryGraph = new QueryGraphForge(5, null, false);
            queryGraph.AddStrictEquals(0, "P0", Make(0, "P0"), 1, "P1", Make(1, "P1"));
            queryGraph.AddStrictEquals(3, "P3", Make(3, "P3"), 4, "P4", Make(4, "P4"));
            queryGraph.AddStrictEquals(2, "P2", Make(2, "P2"), 3, "P3", Make(3, "P3"));
            queryGraph.AddStrictEquals(1, "P1", Make(1, "P1"), 2, "P2", Make(2, "P2"));

            QueryGraphForge.FillEquivalentNav(types, queryGraph);

            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 5; j++)
                {
                    if (i == j)
                    {
                        continue;
                    }
                    Assert.IsTrue(queryGraph.IsNavigableAtAll(i, j), "Not navigable: i=" + i + " j=" + j);
                }
            }
        }