Exemplo n.º 1
0
        public void Filter3()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Tbool tb1 = new Tbool(false);

            tb1.AddState(new DateTime(2005, 12, 20), true);

            Tbool tb2 = new Tbool(false);

            tb2.AddState(new DateTime(2008, 3, 8), true);

            Facts.Assert(P1, "IsParentOf", P3, tb1);
            Facts.Assert(P1, "IsParentOf", P4, tb2);
            Facts.Assert(P1, "IsParentOf", P1, false);  // An absurd thing to have to assert

            Tset people = new Tset(P1, P3, P4);
            Tset result = people.Filter(_ => IsParentOf(P1, _));

            Assert.AreEqual("{Dawn: ; 12/20/2005: P3; 3/8/2008: P3, P4}", result.Out);
        }
Exemplo n.º 2
0
        public void Filter6()
        {
            NewTest();
            Tset theAssets   = TheThings().Filter(_ => Owns(M, _));
            Tset cheapAssets = theAssets.Filter(x => AssetValueLessThan4((Thing)x));

            Assert.AreEqual("{Dawn: A, B; 1/1/2005: A, B, C; 1/1/2008: A, C; 1/14/2011: A}", cheapAssets.Out);
        }
Exemplo n.º 3
0
        public void Filter5a()
        {
            Facts.Clear();
            Thing P1     = new Thing("P1");
            Tset  people = new Tset(P1);
            Tset  result = people.Filter(_ => IsParentOf(_, P1));

            Assert.AreEqual("Unstated", result.Out); // Compare with the test Filter5b below
        }
Exemplo n.º 4
0
        public void Filter5b()
        {
            Facts.Clear();
            Thing P1     = new Thing("P1");
            Tset  people = new Tset(P1);

            Facts.Assert(P1, "IsParentOf", P1, false);
            Tset result = people.Filter(_ => IsParentOf(_, P1));

            Assert.AreEqual("", result.Out);
        }
Exemplo n.º 5
0
        public void Filter2()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Facts.Assert(P1, "IsParentOf", P3, true);
            Facts.Assert(P1, "IsParentOf", P4, true);
            Facts.Assert(P1, "IsParentOf", P1, false);  // An absurd thing to have to assert

            Tset people = new Tset(P1, P3, P4);
            Tset result = people.Filter(_ => IsParentOf(P1, _));

            Assert.AreEqual("P3, P4", result.Out);
        }
Exemplo n.º 6
0
        public void Filter4()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Facts.Assert(P1, "IsParentOf", P3, true);
            Facts.Assert(P1, "IsParentOf", P4, true);
            Facts.Assert(P4, "IsParentOf", P3, false);
            Facts.Assert(P3, "IsParentOf", P3, false);

            Tset people = new Tset(P1, P3, P4);
            Tset result = people.Filter(_ => IsParentOf(_, P3));

            Assert.AreEqual("P1", result.Out);
        }
 public void Filter5b()
 {
     Facts.Clear();
     Thing P1 = new Thing("P1");
     Tset people = new Tset(P1);
     Facts.Assert(P1, "IsParentOf", P1, false);
     Tset result = people.Filter( _ => IsParentOf(_,P1));
     Assert.AreEqual("", result.Out);
 }
 public void Filter5a()
 {
     Facts.Clear();
     Thing P1 = new Thing("P1");
     Tset people = new Tset(P1);
     Tset result = people.Filter( _ => IsParentOf(_,P1));
     Assert.AreEqual("Unstated", result.Out); // Compare with the test Filter5b below
 }
        public void Filter4()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Facts.Assert(P1, "IsParentOf", P3, true);
            Facts.Assert(P1, "IsParentOf", P4, true);
            Facts.Assert(P4, "IsParentOf", P3, false);
            Facts.Assert(P3, "IsParentOf", P3, false);

            Tset people = new Tset(P1,P3,P4);
            Tset result = people.Filter( _ => IsParentOf(_,P3));
            Assert.AreEqual("P1", result.Out);
        }
        public void Filter3()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Tbool tb1 = new Tbool(false);
            tb1.AddState(new DateTime(2005,12,20),true);

            Tbool tb2 = new Tbool(false);
            tb2.AddState(new DateTime(2008,3,8),true);

            Facts.Assert(P1, "IsParentOf", P3, tb1);
            Facts.Assert(P1, "IsParentOf", P4, tb2);
            Facts.Assert(P1, "IsParentOf", P1, false);  // An absurd thing to have to assert

            Tset people = new Tset(P1,P3,P4);
            Tset result = people.Filter( _ => IsParentOf(P1,_));

            Assert.AreEqual("{Dawn: ; 12/20/2005: P3; 3/8/2008: P3, P4}", result.Out);
        }
        public void Filter2()
        {
            Facts.Clear();

            Thing P1 = new Thing("P1");
            Thing P3 = new Thing("P3");
            Thing P4 = new Thing("P4");

            Facts.Assert(P1, "IsParentOf", P3, true);
            Facts.Assert(P1, "IsParentOf", P4, true);
            Facts.Assert(P1, "IsParentOf", P1, false);  // An absurd thing to have to assert

            Tset people = new Tset(P1,P3,P4);
            Tset result = people.Filter( _ => IsParentOf(P1,_));

            Assert.AreEqual("P3, P4", result.Out);
        }