public void DateFirst_5() { // Base Tvar is unknown, then the required value Tbool t = new Tbool(Hstate.Unstated); t.AddState(Date(2000,1,1), true); Assert.AreEqual(Date(2000,1,1), t.DateFirstTrue.ToDateTime); }
public void SlidingElapsedIntervals2() { Tbool tb = new Tbool(false); Tnum r = tb.SlidingElapsedIntervals(TheDay, 2); Assert.AreEqual(0, r.Out); }
public void SlidingElapsedIntervals10() { // Window size is unstated Tbool tb = new Tbool(true); Tnum r = tb.SlidingElapsedIntervals(TheDay, new Tnum(Hstate.Unstated)); Assert.AreEqual("Unstated", r.Out); }
public void RunningElapsedIntervals2() { Tbool tb = new Tbool(false); Tnum r = tb.RunningElapsedIntervals(TheYear); Assert.AreEqual(0, r.Out); }
public void ContinuousElapsedIntervals2() { Tbool tb = new Tbool(false); Tnum r = tb.ContinuousElapsedIntervals(TheMonth); Assert.AreEqual(0, r.Out); }
public void ElapsedDaysPerInterval_5() { Tbool t = new Tbool(false); Tnum n = new Tnum(Hstate.Unstated); Tnum result = t.TotalElapsedDaysPer(n); Assert.AreEqual("Unstated", result.Out); }
public void TotalElapsedIntervals12() { Tbool t = new Tbool(false); t.AddState(Date(2000,1,1), true); t.AddState(Date(2000,2,1), false); Tnum result = t.TotalElapsedIntervals(TheDay, Date(2000,1,15), Date(2000,1,20)); Assert.AreEqual(5, result.Out); }
public void ElapsedDaysPerInterval_2() { Tbool t = new Tbool(false); t.AddState(Date(2000,6,1), true); t.AddState(Date(2001,1,1), false); Tnum result = t.TotalElapsedDaysPer(TheYear); Assert.AreEqual("{Dawn: 0; 1/1/2000: 214; 1/1/2001: 0}", result.Out); }
public void TotalElapsedIntervals1() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1),true); tb.AddState(new DateTime(2015,1,3),false); Tnum r = tb.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual(2, r.Out); }
public void SlidingElapsedIntervals1() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1),true); tb.AddState(new DateTime(2015,1,3),false); Tnum r = tb.SlidingElapsedIntervals(TheDay, 2); Assert.AreEqual("{Dawn: 0; 1/2/2015: 1; 1/3/2015: 2; 1/4/2015: 1; 1/5/2015: 0}", r.Out); }
public void RunningElapsedIntervals4() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2000,1,1), Hstate.Stub); tb.AddState(new DateTime(2000,3,1), false); Tnum r = tb.RunningElapsedIntervals(TheYear); Assert.AreEqual("Stub", r.Out); }
public void TotalElapsedIntervals10() { Tbool t = new Tbool(false); t.AddState(Date(2000,1,1), true); t.AddState(Date(2000,1,2), false); t.AddState(Date(2000,1,3), true); t.AddState(Date(2000,1,4), false); Tnum result = t.TotalElapsedIntervals(TheDay, Date(2010,1,2), Date(2010,1,6)); Assert.AreEqual(0, result.Out); }
public void DateFirst_6() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2000,1,1),true); tb.AddState(new DateTime(2000,1,3),false); tb.AddState(new DateTime(2000,1,10),true); tb.AddState(new DateTime(2000,2,18),false); Assert.AreEqual(Date(2000,1,1), tb.DateFirstTrue.ToDateTime); }
public void ContinuousElapsedIntervals3() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1), Hstate.Unstated); tb.AddState(new DateTime(2015,3,1), false); Tnum r = tb.ContinuousElapsedIntervals(TheDay); Assert.AreEqual("Unstated", r.Out); }
public void SlidingElapsedIntervals4() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1), Hstate.Stub); tb.AddState(new DateTime(2015,3,1), false); Tnum r = tb.SlidingElapsedIntervals(TheDay, 2); Assert.AreEqual("Stub", r.Out); }
public void AssignAndMerge2() { Tbool newCondition = new Tbool(Hstate.Uncertain); Tnum initialResult = new Tnum(Hstate.Null); Tbool newConditionIsUnknown = new Tbool(true); Tnum result = Util.MergeTvars<Tnum>(initialResult, Util.ConditionalAssignment<Tnum>(newConditionIsUnknown, newCondition)); Assert.AreEqual(false, Util.HasUndefinedIntervals(result)); }
public void DateNextTrue3() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1),true); tb.AddState(new DateTime(2015,2,1),false); tb.AddState(new DateTime(2015,3,1),true); tb.AddState(new DateTime(2015,9,1),false); DateTime d = tb.DateNextTrue(Date(2015,2,15)); Assert.AreEqual(new DateTime(2015,3,1), d); }
public void AssignAndMerge1() { Tbool newCondition = new Tbool(Hstate.Uncertain); Tnum initialResult = new Tnum(Hstate.Null); Tbool newConditionIsUnknown = new Tbool(true); Tnum result = Util.MergeTvars<Tnum>(initialResult, Util.ConditionalAssignment<Tnum>(newConditionIsUnknown, newCondition)); Assert.AreEqual("Uncertain", result.Out); }
public void ContinuousElapsedIntervals1() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1), true); tb.AddState(new DateTime(2015,3,1), false); tb.AddState(new DateTime(2015,5,1), true); tb.AddState(new DateTime(2015,6,1), false); Tnum r = tb.ContinuousElapsedIntervals(TheMonth); Assert.AreEqual("{Dawn: 0; 2/1/2015: 1; 3/1/2015: 2; 4/1/2015: 0; 6/1/2015: 1; 7/1/2015: 0}", r.Out); }
public void FT_RunningCountPer_4() { Tbool t = new Tbool(); t.AddState(Time.DawnOf,false); t.AddState(Date(2010,11,1), true); t.AddState(Date(2010,12,1), true); t.AddState(Date(2011,1,1), true); t.AddState(Date(2011,2,1), false); Tnum actual = t.RunningCountPer(TheYear); string expected = "{Dawn: 0; 12/1/2010: 1; 1/1/2011: 0; 2/1/2011: 1; 3/1/2011: 2; 1/1/2012: 0}"; Assert.AreEqual(expected, actual.Out); }
public void RunningElapsedIntervals1() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1),true); tb.AddState(new DateTime(2015,1,2),false); tb.AddState(new DateTime(2015,1,3),true); tb.AddState(new DateTime(2015,1,4),false); Tnum r = tb.RunningElapsedIntervals(TheDay); Assert.AreEqual("{Dawn: 0; 1/2/2015: 1; 1/4/2015: 2}", r.Out); }
public void TotalElapsedIntervals18() { Tbool t = new Tbool(Hstate.Uncertain); Tnum result = t.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual("Uncertain", result.Out); }
public void AssignAndMerge3() { Tbool newCondition = new Tbool(Hstate.Uncertain); Tbool newConditionIsUnknown = Util.HasUnknownState(newCondition); Assert.AreEqual(true, newConditionIsUnknown.Out); }
public void IsBetween0() { Tbool isDuringTheBushYears = Time.IsBetween(Date(2001, 1, 20), Date(2009, 1, 20)); Assert.AreEqual("{Dawn: false; 1/20/2001: true; 1/20/2009: false}", isDuringTheBushYears.Out); }
public void LogicAndTime4() { Tbool t1 = tbv & uncert; Assert.AreEqual("{Dawn: false; 1/1/2000: Uncertain; 1/1/2002: Unstated}", t1.Out); }
public void Unknown_Logic_And_8() { Tbool r = uncert & stub; Assert.AreEqual("Uncertain", r.Out); }
public void Unknown_Logic_And_6() { Tbool r = tbf & stub; Assert.AreEqual(false, r.Out); }
public void IsAtOrAfter3() { Tbool afterY2K = Time.IsAtOrAfter(Date(2000, 1, 1)); Assert.AreEqual(true, afterY2K.AsOf(Date(2000, 1, 1)).Out); }
public void TestTvar6() { Tbool eq = tn1 == tn2; Assert.AreEqual(false, eq.Out); }
public void TestTvar5() { Tbool eq = tb1 == tb2; Assert.AreEqual(true, eq.Out); }
public void Test30_a() { Tbool t = new Tbool(0 > 365); Assert.AreEqual(false, t.Out); }
public void FT_AsOf_8() { Tbool res = new Tbool(Hstate.Uncertain).AsOf(Time.DawnOf.AddYears(2)); Assert.AreEqual("Uncertain", res.Out); }
public void FT_ToBool_1() { Tbool t = new Tbool(true); Assert.AreEqual(true, t.ToBool); }
public void FT_ToBool_2() { Tbool t = new Tbool(false); Assert.AreEqual(false, t.ToBool); }
public void DateFirst_2() { Tbool t = new Tbool(true); Assert.AreEqual(Time.DawnOf, t.DateFirstTrue.ToDateTime); }
public void TotalElapsedIntervals4() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1), Hstate.Stub); tb.AddState(new DateTime(2015,3,1), false); Tnum r = tb.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual("Stub", r.Out); }
public void TotalElapsedIntervals7() { Tbool t = new Tbool(true); Tnum actual = t.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual(73050, actual.Out); }
public void TotalElapsedIntervals14() { Tbool t = new Tbool(true); Tnum result = (!t).TotalElapsedIntervals(TheDay, Date(2000,1,15), Date(2000,1,20)); Assert.AreEqual(0, result.Out); }
public void TnumTypeTest2() { bool isTnum = new Tbool().GetType().ToString() == "Akkadian.Tnum"; Assert.AreEqual(false, isTnum); }
public void TestTvar8() { Tbool t2 = tbu; Assert.AreEqual("Unstated", t2.Out); }
public void Unknown_Logic_And_7() { Tbool r = tbt & stub; Assert.AreEqual("Stub", r.Out); }
public void TestTvar9() { Tbool t2 = tbn; Assert.AreEqual("Uncertain", t2.Out); }
public void LogicAndTime3() { Tbool t1 = tbv & tbf; Assert.AreEqual(false, t1.Out); }
public void TestTvar10() { Tbool t2 = new Tbool(true); Assert.AreEqual(true, t2.Out); }
public void LogicOr1() { Tbool t1 = tbt | tbf; Assert.AreEqual(true, t1.Out); }
public void LogicAnd8() { Tbool r = unstat & uncert; Assert.AreEqual("Unstated", r.Out); }
public void IsBefore3() { Tbool beforeY2K = Time.IsBefore(Date(2000, 1, 1)); Assert.AreEqual(false, beforeY2K.AsOf(Date(2000, 1, 1)).Out); }
public void LogicAnd9() { Tbool t1 = tbt & false; Assert.AreEqual(false, t1.Out); }
public void TotalElapsedIntervals17() { Tbool t = new Tbool(false); Tnum result = t.TotalElapsedIntervals(TheDay, Date(2000,1,1), Date(2010,1,1)); Assert.AreEqual(0, result.Out); }
public void LogicAnd10() { Tbool t1 = false & tbt; Assert.AreEqual(false, t1.Out); }
public void TotalElapsedIntervals2() { Tbool tb = new Tbool(false); Tnum r = tb.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual(0, r.Out); }
public void Unknown_Logic_And_3() { Tbool t1 = tbt & unstat; Assert.AreEqual("Unstated", t1.Out); }
public void TotalElapsedIntervals6() { Tbool t = new Tbool(true); t.AddState(Date(2012,1,1), false); Tnum actual = t.TotalElapsedIntervals(TheDay, Time.DawnOf, Time.EndOf); Assert.AreEqual(40908, actual.Out); }
public void Unknown_Logic_And_4() { Tbool t1 = tbf & unstat; Assert.AreEqual(false, t1.Out); }
public void IsBefore2() { Tbool beforeY2K = Time.IsBefore(Date(2000, 1, 1)); Assert.AreEqual(true, beforeY2K.AsOf(Date(1999, 1, 1)).Out); }
public void Unknown_Logic_And_5() { Tbool r = unstat & stub; Assert.AreEqual("Unstated", r.Out); }
public void TestTvar6a() { Tbool eq = tn0 == tn1; Assert.AreEqual(true, eq.Out); }
public void DateLast_2() { Tbool t = new Tbool(true); Assert.AreEqual(Time.EndOf, t.DateLastTrue.ToDateTime); }
// The sole purpose of this set of tests is to verify that these Akkadian functions // stay within reasonable performance tolerances. They may not all pass all the time, // but they should pass almost all of the time. // Obviously, different machines will execute these functions at different speeds. /// <summary> /// A Tbool used to test the Akkadian functions. /// </summary> private static Tbool Tb1() { Tbool tb = new Tbool(false); tb.AddState(new DateTime(2015,1,1),true); tb.AddState(new DateTime(2015,2,2),false); tb.AddState(new DateTime(2015,3,3),true); tb.AddState(new DateTime(2015,4,4),false); return tb; }
public void TestTvar6b() { Tbool eq = tn1 != tn2; Assert.AreEqual(true, eq.Out); }