public void Test22() { Tset s1 = new Tset(); s1.SetEternally(); Assert.AreEqual(false, s1.Contains(P3).Out); }
public void Count3() { Tset s1 = new Tset(); s1.SetEternally(); Assert.AreEqual(0, s1.Count.Out); }
public void IsEmpty2() { Tset s1 = new Tset(); s1.SetEternally(); Assert.AreEqual(true, s1.IsEmpty.Out); }
public void Test1_2() { Tset s1 = new Tset(); s1.SetEternally(); Assert.AreEqual("", s1.Out); }
public void Test11() { Tset s1 = new Tset(P1, P2); Tset s2 = new Tset(); s2.SetEternally(); Assert.AreEqual(true, s2.IsSubsetOf(s1).Out); }
public void Count2() { // This is how you assert an eternally empty set Tset s1 = new Tset(); s1.SetEternally(); Assert.AreEqual(0, s1.Count.Out); }
public void Complement3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tset res = s1 - s2; Assert.AreEqual("", res.Out); }
public void Union3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tset res = s1 | s2; Assert.AreEqual("P2, P3", res.Out); }
public void Test74() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tbool res = s2 != s1; Assert.AreEqual(true, res.Out); }
public void Test62() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tbool res = s1 == s2; Assert.AreEqual(false, res.Out); }
public void Complement5() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tset res = s2 - s1; Assert.AreEqual("P2, P3", res.Out); }
public void Complement3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tset res = s1 - s2; Assert.AreEqual("", res.Out); }
public void Intersection3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2, P3); Tset res = s1 & s2; Assert.AreEqual("", res.Out); }
public void Union3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tset res = s1 | s2; Assert.AreEqual("P2, P3", res.Out); }
public void Test74() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tbool res = s2 != s1; Assert.AreEqual(true, res.Out); }
public void Test62() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tbool res = s1 == s2; Assert.AreEqual(false, res.Out); }
public void Test12() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P1,P2); Assert.AreEqual(false, s2.IsSubsetOf(s1).Out); }
public void Intersection3() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tset res = s1 & s2; Assert.AreEqual("", res.Out); }
/// <summary> /// Asserts a fact. /// </summary> public static void AssertAnswer(Engine.Response response, string val) { // Get the data pertaining to the current question Thing subj = (Thing)response.NextFact.Arg1; Thing obj = (Thing)response.NextFact.Arg2; string rel = response.NextFact.Relationship; string qType = Templates.GetQ(rel).questionType; // Create the fact/relationship text for the .akk unit test if (qType != "Tset") { AkkTest.testStr += AkkTest.assertedRelationship; } // Assert the fact (converted to the proper type of Tvar) if (qType == "Tbool") { // Asserts the fact (handling uncertainty) // Also, creates part of the .akk unit test string if (val == "?") { Facts.Assert(subj, rel, obj, new Tbool(Hstate.Uncertain)); AkkTest.testStr += "Tbool(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TboolFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tstr") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tstr(Hstate.Uncertain)); AkkTest.testStr += "Tstr(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TstrFromTemporalString(val)); AkkTest.testStr += "\"" + val + "\"\r\n"; } } else if (qType == "Tnum") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tnum(Hstate.Uncertain)); AkkTest.testStr += "Tnum(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TnumFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tdate") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tdate(Hstate.Uncertain)); AkkTest.testStr += "Tdate(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TdateFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tset") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tset(Hstate.Uncertain)); AkkTest.testStr += "Tset(?)\r\n"; } else { // Assert an empty set if (val == "[]") { Tset result = new Tset(); result.SetEternally(); Facts.Assert(subj, rel, obj, result); } else { // Create a list of Things string[] items = val.Split(new char[] { ';' }); List <Thing> list = new List <Thing>(); string thingList = ""; // for .akk unit tests foreach (string i in items) { string name = i.Trim(); list.Add(Facts.AddThing(name)); thingList += name + ","; } // Assert the Tset Facts.Assert(subj, rel, obj, new Tset(list)); // Build the .akk unit test string AkkTest.testStr += "- Things " + thingList.TrimEnd(',') + "\r\n"; AkkTest.testStr += AkkTest.assertedRelationship; AkkTest.testStr += "[[" + val.Replace(";", ",") + "]]\r\n"; } } } }
public void Complement5() { Tset s1 = new Tset(); s1.SetEternally(); Tset s2 = new Tset(P2,P3); Tset res = s2 - s1; Assert.AreEqual("P2, P3", res.Out); }
/// <summary> /// Asserts a fact. /// </summary> public static void AssertAnswer(Engine.Response response, string val) { // Get the data pertaining to the current question Thing subj = (Thing)response.NextFact.Arg1; Thing obj = (Thing)response.NextFact.Arg2; string rel = response.NextFact.Relationship; string qType = Templates.GetQ(rel).questionType; // Create the fact/relationship text for the .akk unit test if (qType != "Tset") AkkTest.testStr += AkkTest.assertedRelationship; // Assert the fact (converted to the proper type of Tvar) if (qType == "Tbool") { // Asserts the fact (handling uncertainty) // Also, creates part of the .akk unit test string if (val == "?") { Facts.Assert(subj, rel, obj, new Tbool(Hstate.Uncertain)); AkkTest.testStr += "Tbool(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TboolFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tstr") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tstr(Hstate.Uncertain)); AkkTest.testStr += "Tstr(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TstrFromTemporalString(val)); AkkTest.testStr += "\"" + val + "\"\r\n"; } } else if (qType == "Tnum") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tnum(Hstate.Uncertain)); AkkTest.testStr += "Tnum(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TnumFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tdate") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tdate(Hstate.Uncertain)); AkkTest.testStr += "Tdate(?)\r\n"; } else { Facts.Assert(subj, rel, obj, TdateFromTemporalString(val)); AkkTest.testStr += val + "\r\n"; } } else if (qType == "Tset") { if (val == "?") { Facts.Assert(subj, rel, obj, new Tset(Hstate.Uncertain)); AkkTest.testStr += "Tset(?)\r\n"; } else { // Assert an empty set if (val == "[]") { Tset result = new Tset(); result.SetEternally(); Facts.Assert(subj, rel, obj, result); } else { // Create a list of Things string[] items = val.Split(new char[] {';'}); List<Thing> list = new List<Thing>(); string thingList = ""; // for .akk unit tests foreach (string i in items) { string name = i.Trim(); list.Add(Facts.AddThing(name)); thingList += name + ","; } // Assert the Tset Facts.Assert(subj, rel, obj, new Tset(list)); // Build the .akk unit test string AkkTest.testStr += "- Things " + thingList.TrimEnd(',') + "\r\n"; AkkTest.testStr += AkkTest.assertedRelationship; AkkTest.testStr += "[[" + val.Replace(";",",") + "]]\r\n"; } } } }