public void TestFuturesAndNormal() { var t1 = new test_future <int>(6); var t3 = t1.AddTo(3); Assert.IsTrue(t3.HasValue, "has a value"); Assert.AreEqual(9, t3.Value, "Value"); }
public void SelectForOneAsMonad() { var tf1 = new test_future <int>(3); var tf2 = from t1 in tf1 select t1 * 2; Assert.IsTrue(tf2.HasValue); Assert.AreEqual(6, tf2.Value); }
public void TestDivideByFutureAndNormal() { var t1 = new test_future <double>(6); var t3 = t1.DivideBy(3.0); Assert.IsTrue(t3.HasValue, "has a value"); Assert.AreEqual(2.0, t3.Value, "Value"); }
public void TestDivideByTwoFutures() { var t1 = new test_future <int>(6); var t2 = new test_future <int>(3); var t3 = t1.DivideBy(t2); Assert.IsTrue(t3.HasValue, "has a value"); Assert.AreEqual(2.0, t3.Value, "Value"); }
public void SelectManyTwoMonads() { var tf1 = new test_future <int>(6); var tf2 = new test_future <int>(3); var t3 = from t1 in tf1 from t2 in tf2 select t1 / t2; Assert.IsTrue(t3.HasValue); Assert.AreEqual(2, t3.Value); }
public void TestCast() { var t1 = new test_future <ROOTNET.NTLorentzVector>(new ROOTNET.NTLorentzVector(10, 11, 12, 13)); var t2 = t1.Cast().To <ROOTNET.Interface.NTLorentzVector>(); Assert.IsTrue(t2.HasValue, "t2 has value"); Assert.IsNotNull(t2.Value, "cast guy should not be null"); var t3 = t1.Cast().To <ROOTNET.Interface.NTNamed>(); Assert.IsNull(t3.Value, "value is null"); }
public void TestFuturesMultiply() { var t1 = new test_future <int>(6); var t2 = new test_future <int>(6); var t3 = t1.MultiplyBy(t2); Assert.IsTrue(t3.HasValue, "Has Value"); Assert.AreEqual(36, t3.Value, "value"); var t4 = t1.MultiplyBy(6); Assert.IsTrue(t4.HasValue, "t4 has value"); Assert.AreEqual(36, t4.Value, "value for plain subtract"); }