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 Misc_TemporalRecursion4() { Tnum x = new Tnum(); x.AddState(Time.DawnOf, 10); x.AddState(new DateTime(2000,1,1), 1); Assert.AreEqual("{Dawn: 89; 1/1/2000: 1}", TemporalFibonacci(x).Out); }
public void Performance_RunningSummedIntervals_1() { DateTime startTime = DateTime.Now; Tnum t = new Tnum(9.99).RunningSummedIntervals(TheDay); int ResponseTimeInMs = Convert.ToInt32((DateTime.Now - startTime).TotalMilliseconds); Assert.IsTrue(ResponseTimeInMs < 85); }
public void HasUndefinedIntervals1() { Tnum r = new Tnum(new Hval(null,Hstate.Null)); r.AddState(Date(2000,1,1), new Hval(null,Hstate.Unstated)); r.AddState(Date(2001,1,1), 2); Assert.AreEqual(true, Util.HasUndefinedIntervals(r)); }
public void RunningSummedIntervals_1() { Tnum t = new Tnum(0); t.AddState(Date(2012, 1, 1), 1000); t.AddState(Date(2012, 3, 1), 0); Tnum r = t.RunningSummedIntervals(TheMonth); Assert.AreEqual("{Dawn: 0; 2/1/2012: 1000; 3/1/2012: 2000}", 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 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 TotalSummedIntervals_5() { Tnum t = new Tnum(1000); t.AddState(Date(2015, 6, 1), 2000); Tnum r = t.TotalSummedIntervals(TheMonth, Date(2015,1,1), Date(2016,1,1)); Assert.AreEqual(19000, r.Out); }
public void SlidingSummedIntervals_7() { Tnum t = new Tnum(Hstate.Unstated); t.AddState(Date(2013, 1, 1), 2000); Tnum r = t.SlidingSummedIntervals(TheYear, 2); Assert.AreEqual("Unstated", r.Out); }
public void SlidingSummedIntervals_4() { Tnum t = new Tnum(1000); t.AddState(Date(2013, 1, 1), 2000); Tnum r = t.SlidingSummedIntervals(TheYear, 2); Assert.AreEqual("{Dawn: 2000; 1/1/2014: 3000; 1/1/2015: 4000}", r.Out); }
public void Near10() { Tnum res = new Tnum(88.34).RoundToNearest(1); Assert.AreEqual(88.00, res.Out); }
public void Down4() { Tnum res = new Tnum(1324103).RoundDown(50000); Assert.AreEqual(1300000, res.Out); }
public void Down1() { Tnum res = new Tnum(121).RoundDown(10); Assert.AreEqual(120, res.Out); }
public void ToUSD_1() { Tstr res = new Tnum(88.369).ToUSD; Assert.AreEqual("$88.37", res.Out); }
public void Up5() { Tnum res = new Tnum(1324103).RoundUp(50000); Assert.AreEqual(1350000, res.Out); }
public void Up4() { Tnum res = new Tnum(7.5).RoundUp(0.25); Assert.AreEqual(7.5, res.Out); }
public void Up3() { Tnum res = new Tnum(7.33).RoundUp(0.25); Assert.AreEqual(7.50, res.Out); }
public void Up2() { Tnum res = new Tnum(120).RoundUp(10); Assert.AreEqual(120, res.Out); }
public void ToUSD_7() { Tstr res = new Tnum(2).ToUSD; Assert.AreEqual("$2.00", res.Out); }
public void ToUSD_6() { Tstr res = new Tnum(-44988).ToUSD; Assert.AreEqual("($44,988.00)", res.Out); }
public void ToUSD_5() { Tstr res = new Tnum(new Hval()).ToUSD; Assert.AreEqual("Unstated", res.Out); }
public void ToUSD_4() { Tstr res = new Tnum(44988).ToUSD; Assert.AreEqual("$44,988.00", res.Out); }
public void SlidingSummedIntervals_1() { Tnum t = new Tnum(1000); Tnum r = t.SlidingSummedIntervals(TheMonth, 2); Assert.AreEqual(2000, r.Out); }
public void Down3() { Tnum res = new Tnum(7.5).RoundDown(0.25); Assert.AreEqual(7.5, res.Out); }
public void Down5() { Tnum res = new Tnum(0).RoundDown(1); Assert.AreEqual(0, res.Out); }
public void Near9() { Tnum res = new Tnum(88.34).RoundToNearest(0.10); Assert.AreEqual(88.30, res.Out); }
public void Near3() { Tnum res = new Tnum(125).RoundToNearest(10); Assert.AreEqual(130, res.Out); }
public void Near6() { Tnum res = new Tnum(125).RoundToNearest(10, true); Assert.AreEqual(120, res.Out); }
public void SlidingSummedIntervals_6() { Tnum t = new Tnum(Hstate.Stub); Tnum r = (new Tnum(6)).SlidingSummedIntervals(t, 2); Assert.AreEqual("Stub", r.Out); }
public void RunningSummedIntervals_2() { Tnum t = new Tnum(0); Tnum r = t.RunningSummedIntervals(TheMonth); Assert.AreEqual(0, r.Out); }
public void TotalSummedIntervals_2() { Tnum t = new Tnum(Hstate.Unstated); Tnum r = t.TotalSummedIntervals(TheMonth, Date(2015,1,1), Date(2015,12,31)); Assert.AreEqual("Unstated", r.Out); }
public void RunningSummedIntervals_4() { Tnum t = new Tnum(Hstate.Stub); Tnum r = t.RunningSummedIntervals(TheMonth); Assert.AreEqual("Stub", r.Out); }
public void SlidingSummedIntervals_3() { Tnum t = new Tnum(Hstate.Stub); Tnum r = t.SlidingSummedIntervals(TheMonth, 2); Assert.AreEqual("Stub", r.Out); }
public void ToUSD_3() { Tstr res = new Tnum(88).ToUSD; Assert.AreEqual("$88.00", res.Out); }
public void RunningSummedIntervals_3() { Tnum t = new Tnum(Hstate.Unstated); Tnum r = t.RunningSummedIntervals(TheMonth); Assert.AreEqual("Unstated", r.Out); }
private static Tnum Tn1() { Tnum tn = new Tnum(0); tn.AddState(Date(2010, 01, 01), 7000); tn.AddState(Date(2013, 01, 01), 6000); tn.AddState(Date(2015, 01, 01), 5090); tn.AddState(Date(2017, 01, 01), 4470); return tn; }
public void RunningSummedIntervals_5() { Tnum t = new Tnum(Hstate.Stub); Tnum r = (new Tnum(10)).RunningSummedIntervals(t); Assert.AreEqual("Stub", r.Out); }
public void SlidingSummedIntervals_2() { Tnum t = new Tnum(Hstate.Unstated); Tnum r = t.SlidingSummedIntervals(TheMonth, 2); Assert.AreEqual("Unstated", r.Out); }
public void Performance_Subtraction() { // ~10ms DateTime startTime = DateTime.Now; Tnum t = new Tnum(10) + Tn1(); int ResponseTimeInMs = Convert.ToInt32((DateTime.Now - startTime).TotalMilliseconds); Assert.IsTrue(ResponseTimeInMs < 10); }