Exemple #1
0
        public void Test_AsOf_2()
        {
            Tset s1 = new Tset();

            s1.AddState(Time.DawnOf, P1, P2);
            s1.AddState(Time.DawnOf.AddYears(3), P2);
            Assert.AreEqual("P1, P2", s1.AsOf(Time.DawnOf.AddYears(2)).Out);        // Lean not working
        }
Exemple #2
0
        public void Test0_1()
        {
            Tset s1 = new Tset();

            s1.AddState(Time.DawnOf, P1);
            s1.AddState(Time.DawnOf.AddYears(1), P1);
            Assert.AreEqual("P1", s1.Lean.Out);
        }
        public void CountUnknown1()
        {
            Thing P1  = new Thing("P1");
            Tset  tsv = new Tset(Hstate.Stub);

            tsv.AddState(Date(2000, 01, 01), P1);
            tsv.AddState(Date(2001, 01, 01), Hstate.Uncertain);
            Assert.AreEqual("{Dawn: Stub; 1/1/2000: 1; 1/1/2001: Uncertain}", tsv.Count.Out);
        }
Exemple #4
0
        public void ObjectAsOf2()
        {
            Thing P1  = new Thing("P1");
            Tset  tsv = new Tset(Hstate.Stub);

            tsv.AddState(Date(2000, 01, 01), P1);
            tsv.AddState(Date(2001, 01, 01), Hstate.Uncertain);
            Assert.AreEqual(Hstate.Uncertain, tsv.ObjectAsOf(Date(2002, 02, 01)).Val);
        }
Exemple #5
0
        public void Constructor1()
        {
            Tset s1 = new Tset();

            s1.AddState(Time.DawnOf, P1);
            s1.AddState(Time.DawnOf.AddYears(1), P1);
            Tset s2 = new Tset(s1);

            Assert.AreEqual("P1", s2.Lean.Out);
        }
Exemple #6
0
        /// <summary>
        /// Asserts a given fact (of the proper Tvar type)
        /// </summary>
        private static void AssertFact(Factoid f)
        {
            // Instantiate relevant Things
            Thing t1 = f.Arg1.ToString() != "" ? Facts.AddThing(f.Arg1.ToString()) : null;
            Thing t2 = f.Arg2.ToString() != "" ? Facts.AddThing(f.Arg2.ToString()) : null;
            Thing t3 = f.Arg3.ToString() != "" ? Facts.AddThing(f.Arg3.ToString()) : null;

            // Sometimes I have my doubts about static typing...
            if (f.FactType == "Tbool")
            {
                Tbool val = new Tbool();
                foreach (TemporalValue v in f.Timeline)
                {
                    val.AddState(v.Date, new Hval(v.Value));
                }
                Facts.Assert(t1, f.Relationship, t2, t3, val);
            }
            else if (f.FactType == "Tnum")
            {
                Tnum val = new Tnum();
                foreach (TemporalValue v in f.Timeline)
                {
                    val.AddState(v.Date, new Hval(v.Value));
                }
                Facts.Assert(t1, f.Relationship, t2, t3, val);
            }
            else if (f.FactType == "Tstr")
            {
                Tstr val = new Tstr();
                foreach (TemporalValue v in f.Timeline)
                {
                    val.AddState(v.Date, new Hval(v.Value));
                }
                Facts.Assert(t1, f.Relationship, t2, t3, val);
            }
            else if (f.FactType == "Tdate")
            {
                Tdate val = new Tdate();
                foreach (TemporalValue v in f.Timeline)
                {
                    val.AddState(v.Date, new Hval(v.Value));
                }
                Facts.Assert(t1, f.Relationship, t2, t3, val);
            }
            else if (f.FactType == "Tset")
            {
                Tset val = new Tset();
                foreach (TemporalValue v in f.Timeline)
                {
                    val.AddState(v.Date, new Hval(v.Value));
                }
                Facts.Assert(t1, f.Relationship, t2, t3, val);
            }
        }
 public void ObjectAsOf2()
 {
     Thing P1 = new Thing("P1");
     Tset tsv = new Tset(Hstate.Stub);
     tsv.AddState(Date(2000,01,01),P1);
     tsv.AddState(Date(2001,01,01),Hstate.Uncertain);
     Assert.AreEqual(Hstate.Uncertain, tsv.ObjectAsOf(Date(2002,02,01)).Val);
 }
 public void CountUnknown1()
 {
     Thing P1 = new Thing("P1");
     Tset tsv = new Tset(Hstate.Stub);
     tsv.AddState(Date(2000,01,01),P1);
     tsv.AddState(Date(2001,01,01),Hstate.Uncertain);
     Assert.AreEqual("{Dawn: Stub; 1/1/2000: 1; 1/1/2001: Uncertain}", tsv.Count.Out);
 }
 public void Test_AsOf_2()
 {
     Tset s1 = new Tset();
     s1.AddState(Time.DawnOf, P1, P2);
     s1.AddState(Time.DawnOf.AddYears(3), P2);
     Assert.AreEqual("P1, P2", s1.AsOf(Time.DawnOf.AddYears(2)).Out);        // Lean not working
 }
 public void Test0_1()
 {
     Tset s1 = new Tset();
     s1.AddState(Time.DawnOf, P1);
     s1.AddState(Time.DawnOf.AddYears(1), P1);
     Assert.AreEqual("P1", s1.Lean.Out);
 }
 public void Constructor1()
 {
     Tset s1 = new Tset();
     s1.AddState(Time.DawnOf, P1);
     s1.AddState(Time.DawnOf.AddYears(1), P1);
     Tset s2 = new Tset(s1);
     Assert.AreEqual("P1", s2.Lean.Out);
 }