public void TestCheckAllRequirements1() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier7"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); var app = res.CheckAllRequirements(ref master); System.Console.WriteLine(app.Count); Assert.IsTrue(app.Count == 5); Assert.IsTrue(app.ContainsKey(Constants.POSITIVE_PLUS)); Assert.IsTrue(app[Constants.POSITIVE_PLUS].Count == 0); Assert.IsTrue(app.ContainsKey(Constants.NEGATIVE_PLUS)); Assert.IsTrue(app[Constants.NEGATIVE_PLUS].Count == 0); Assert.IsTrue(app[Constants.POSITIVE].Count == 2); Assert.IsTrue(app[Constants.POSITIVE].ContainsKey("Please call me #player_name#.")); Assert.IsTrue(app[Constants.POSITIVE].ContainsKey("I prefer #player_name#. Thank you.")); Assert.IsTrue(app[Constants.NEUTRAL].Count == 3); Assert.IsTrue(app[Constants.NEUTRAL].ContainsKey("My name is #player_name#.")); Assert.IsTrue(app[Constants.NEUTRAL].ContainsKey("#player_name#")); Assert.IsTrue(app[Constants.NEGATIVE].Count == 2); Assert.IsTrue(app[Constants.NEGATIVE].ContainsKey("Have you read my resume? My name is #player_name#")); Assert.IsTrue(app[Constants.NEGATIVE].ContainsKey("My name is #player_name# and don't forget it.")); }
public void TestFindUniqueCustomResponse() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier9"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 6); //test with one option var branch = res.FindUniqueCustomResponse(Constants.POSITIVE_PLUS, Constants.POSITIVE); Assert.IsTrue(branch.Equals(Constants.NEUTRAL)); branch = res.FindUniqueCustomResponse(Constants.NEGATIVE_PLUS, Constants.NEGATIVE); Assert.IsTrue(branch.Equals(Constants.NEUTRAL)); d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; stuff = SetTone(d); package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier999"); master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); //test with no option branch = res.FindUniqueCustomResponse(Constants.POSITIVE_PLUS, Constants.POSITIVE); Assert.IsTrue(branch.Length == 0); }
public void TestPullResponse1() { double[] d = new double[] { 0, 0, 0, 0, 0, 0, 0, 0 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier9"); for (int i = 0; i < 100; i++) { var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); var app = res.ApplicableResponses; List <string> dialogue = new List <string>(); var temp = res.PullPositive(ref app); res.Responses.Add(temp); foreach (string k in temp.Keys) { dialogue.Add(k); } temp = res.PullNeutral(ref app); res.Responses.Add(temp); foreach (string k in temp.Keys) { dialogue.Add(k); } temp = res.PullNegative(ref app); res.Responses.Add(temp); foreach (string k in temp.Keys) { dialogue.Add(k); } temp = res.PullCustom(ref app); res.Responses.Add(temp); foreach (string k in temp.Keys) { dialogue.Add(k); } for (int j = 0; j < dialogue.Count; j++) { for (int l = j + 1; l < dialogue.Count; l++) { Assert.IsFalse(dialogue[j].Equals(dialogue[l])); } } } }
public void TestPickResponse() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier7"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.POSITIVE].Count == 2); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 3); Assert.IsTrue(res.ApplicableResponses[Constants.NEGATIVE].Count == 2); //test that one of the two pos strings are selected when both are present var q = res.PickResponse(Constants.POSITIVE); System.Console.WriteLine(); Assert.IsTrue(q.Count == 1); foreach (string s in q.Keys) { Assert.IsTrue(s.Equals("Please call me #player_name#.") || s.Equals("I prefer #player_name#. Thank you.")); } //test that the other selection is chosen when var temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["Please call me #player_name#."] = master[Constants.POSITIVE]["Please call me #player_name#."]; res.Responses.Add(temp); q = res.PickResponse(Constants.POSITIVE); System.Console.WriteLine(); Assert.IsTrue(q.Count == 1); foreach (string s in q.Keys) { Assert.IsTrue(s.Equals("I prefer #player_name#. Thank you.")); } //test no options temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I prefer #player_name#. Thank you."] = master[Constants.POSITIVE]["I prefer #player_name#. Thank you."]; res.Responses.Add(temp); q = res.PickResponse(Constants.POSITIVE); Assert.IsTrue(q == null); q = res.PickResponse(Constants.POSITIVE_PLUS); Assert.IsTrue(q == null); q = res.PickResponse(Constants.NEGATIVE_PLUS); Assert.IsTrue(q == null); }
public void TestHandleEmptyBranchValues() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier7"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.POSITIVE].Count == 2); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 3); Assert.IsTrue(res.ApplicableResponses[Constants.NEGATIVE].Count == 2); var branch = res.HandleEmptyBranchString(Constants.POSITIVE_PLUS); Assert.IsTrue(branch.Equals(Constants.POSITIVE_PLUS)); branch = res.HandleEmptyBranchString(Constants.NEGATIVE_PLUS); Assert.IsTrue(branch.Equals(Constants.NEGATIVE_PLUS)); for (int i = 0; i < 100; i++) { branch = res.HandleEmptyBranchString(""); Assert.IsTrue(branch.Equals(Constants.POSITIVE) || branch.Equals(Constants.NEUTRAL) || branch.Equals(Constants.NEGATIVE)); } //no possible values package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier317"); master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.POSITIVE].Count == 0); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 0); Assert.IsTrue(res.ApplicableResponses[Constants.NEGATIVE].Count == 0); branch = res.HandleEmptyBranchString(Constants.POSITIVE_PLUS); Assert.IsTrue(branch.Equals(Constants.POSITIVE_PLUS)); branch = res.HandleEmptyBranchString(Constants.NEGATIVE_PLUS); Assert.IsTrue(branch.Equals(Constants.NEGATIVE_PLUS)); for (int i = 0; i < 100; i++) { branch = res.HandleEmptyBranchString(""); Assert.IsTrue(branch.Length == 0); } }
public void TestOrderRelationshipBranches() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var item = SetTone(d); DialoguePackage package = new DialoguePackage(); List <string> list = res.OrderRelationshipBranches(ref package, item); Assert.IsTrue(list[0].Equals("romance")); Assert.IsTrue(list[4].Equals("affinity")); Assert.IsTrue(list[7].Equals("rivalry")); Assert.IsTrue(res.PlusFlag); Assert.IsTrue(res.Relationship.Equals("romance")); d = new double[] { 100, 200, 300, 400, 500, 600, 700, 800 }; item = SetTone(d); list = res.OrderRelationshipBranches(ref package, item); Assert.IsTrue(list[0].Equals("rivalry")); Assert.IsTrue(list[4].Equals("respect")); Assert.IsTrue(list[7].Equals("romance")); Assert.IsTrue(res.PlusFlag); Assert.IsTrue(res.Relationship.Equals("rivalry")); d = new double[] { 0, 0, 0, 0, 0, 0, 700, 0 }; item = SetTone(d); list = res.OrderRelationshipBranches(ref package, item); Assert.IsTrue(list[0].Equals("hate")); Assert.IsTrue(res.PlusFlag); Assert.IsTrue(res.Relationship.Equals("hate")); d = new double[] { 0, 0, 0, 0, 0, 0, 300, 0 }; item = SetTone(d); list = res.OrderRelationshipBranches(ref package, item); Assert.IsTrue(list[0].Equals("hate")); Assert.IsTrue(!res.PlusFlag); Assert.IsTrue(res.Relationship.Equals("hate")); d = new double[] { 0, 0, 0, 0, 0, 40, 30, 20 }; item = SetTone(d); list = res.OrderRelationshipBranches(ref package, item); Assert.IsTrue(list[0].Equals("disgust")); Assert.IsTrue(list[1].Equals("hate")); Assert.IsTrue(list[2].Equals("rivalry")); Assert.IsTrue(!res.PlusFlag); Assert.IsTrue(res.Relationship.Equals("neutral")); }
public void TestCheckRequirements2() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier7"); var master = ctrl.Lib.Data["sample2_response"]["positive+"]; res.OrderRelationshipBranches(ref package, stuff); var item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 0); master = ctrl.Lib.Data["sample2_response"]["positive"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 2); Assert.IsTrue(item.ContainsKey("Please call me #player_name#.")); Assert.IsTrue(item.ContainsKey("I prefer #player_name#. Thank you.")); master = ctrl.Lib.Data["sample2_response"]["neutral"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 3); Assert.IsTrue(item.ContainsKey("My name is #player_name#.")); Assert.IsTrue(item.ContainsKey("#player_name#")); master = ctrl.Lib.Data["sample2_response"]["negative"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 2); Assert.IsTrue(item.ContainsKey("Have you read my resume? My name is #player_name#")); Assert.IsTrue(item.ContainsKey("My name is #player_name# and don't forget it.")); master = ctrl.Lib.Data["sample2_response"]["negative+"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 0); }
public void TestCheckAllRequirements2() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier9"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); var app = res.CheckAllRequirements(ref master); System.Console.WriteLine(app.Count); Assert.IsTrue(app.Count == 5); Assert.IsTrue(app[Constants.POSITIVE_PLUS].Count == 0); Assert.IsTrue(app[Constants.POSITIVE].Count == 0); Assert.IsTrue(app[Constants.NEUTRAL].Count == 6); Assert.IsTrue(app[Constants.NEGATIVE].Count == 0); Assert.IsTrue(app[Constants.NEGATIVE_PLUS].Count == 0); }
public void TestCheckRequirements1() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.tag1"); var master = ctrl.Lib.Data["sample1_response"]["positive+"]; res.OrderRelationshipBranches(ref package, stuff); var item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 6); Assert.IsTrue(item.ContainsKey("positive+ test 1")); Assert.IsTrue(item.ContainsKey("positive+ test 2")); Assert.IsTrue(item.ContainsKey("positive+ test 3")); Assert.IsTrue(item.ContainsKey("positive+ test 10")); Assert.IsTrue(item.ContainsKey("positive+ test 11")); Assert.IsTrue(item.ContainsKey("positive+ test 12")); master = ctrl.Lib.Data["sample1_response"]["positive"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 6); Assert.IsTrue(item.ContainsKey("positive test 1")); Assert.IsTrue(item.ContainsKey("positive test 2")); Assert.IsTrue(item.ContainsKey("positive test 3")); Assert.IsTrue(item.ContainsKey("positive test 10")); Assert.IsTrue(item.ContainsKey("positive test 11")); Assert.IsTrue(item.ContainsKey("positive test 12")); master = ctrl.Lib.Data["sample1_response"]["neutral"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 6); Assert.IsTrue(item.ContainsKey("neutral test 1")); Assert.IsTrue(item.ContainsKey("neutral test 2")); Assert.IsTrue(item.ContainsKey("neutral test 3")); Assert.IsTrue(item.ContainsKey("neutral test 10")); Assert.IsTrue(item.ContainsKey("neutral test 11")); Assert.IsTrue(item.ContainsKey("neutral test 12")); master = ctrl.Lib.Data["sample1_response"]["negative"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 6); Assert.IsTrue(item.ContainsKey("negative test 1")); Assert.IsTrue(item.ContainsKey("negative test 2")); Assert.IsTrue(item.ContainsKey("negative test 3")); Assert.IsTrue(item.ContainsKey("negative test 10")); Assert.IsTrue(item.ContainsKey("negative test 11")); Assert.IsTrue(item.ContainsKey("negative test 12")); master = ctrl.Lib.Data["sample1_response"]["negative+"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 6); Assert.IsTrue(item.ContainsKey("negative+ test 1")); Assert.IsTrue(item.ContainsKey("negative+ test 2")); Assert.IsTrue(item.ContainsKey("negative+ test 3")); Assert.IsTrue(item.ContainsKey("negative+ test 10")); Assert.IsTrue(item.ContainsKey("negative+ test 11")); Assert.IsTrue(item.ContainsKey("negative+ test 12")); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.tag10"); master = ctrl.Lib.Data["sample1_response"]["negative+"]; res.OrderRelationshipBranches(ref package, stuff); item = res.CheckRequirements(master); Assert.IsTrue(item.Count == 3); Assert.IsTrue(item.ContainsKey("negative+ test 10")); Assert.IsTrue(item.ContainsKey("negative+ test 11")); Assert.IsTrue(item.ContainsKey("negative+ test 12")); }
public void TestAttemptToFindResponse() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier7"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.POSITIVE].Count == 2); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 3); Assert.IsTrue(res.ApplicableResponses[Constants.NEGATIVE].Count == 2); List <string> dialogueInResponses = new List <string>(); var temp = new Dictionary <string, Dictionary <string, List <string> > >(); var dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsTrue(dialogue.Length > 0); //1 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } //2 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } //3 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } //4 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } //5 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } //6 temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); for (int i = 0; i < 100; i++) { dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsFalse(dialogueInResponses.Contains(dialogue)); Assert.IsTrue(dialogue.Length > 0); } temp[dialogue] = Helper1A(dialogue, master); res.Responses.Add(temp); dialogueInResponses.Add(dialogue); //7 dialogue = res.AttemptToFindNonRepeatingAvailableResponse(); Assert.IsTrue(dialogue.Length == 0); }
public void TestAttemptToFindSpecificResponse() { double[] d = new double[] { 800, 700, 600, 500, 400, 300, 200, 100 }; var stuff = SetTone(d); DialoguePackage package = new DialoguePackage(); package.Req["test"] = new List <string>(); package.Req["test"].Add("response_tag.intro_tier9"); var master = ctrl.Lib.Data["sample2_response"]; res.OrderRelationshipBranches(ref package, stuff); res.ApplicableResponses = res.CheckAllRequirements(ref master); Assert.IsTrue(res.ApplicableResponses[Constants.NEUTRAL].Count == 6); string branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.POSITIVE_PLUS); Assert.IsTrue(branch.Length == 0); branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.POSITIVE); Assert.IsTrue(branch.Length == 0); branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.NEGATIVE); Assert.IsTrue(branch.Length == 0); branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.NEGATIVE_PLUS); Assert.IsTrue(branch.Length == 0); branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.NEUTRAL); Assert.IsTrue(branch.Length > 0); var temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I am in control, consistant, perfect, relentless, and fearless"] = master[Constants.NEUTRAL]["I am in control, consistant, perfect, relentless, and fearless"]; res.Responses.Add(temp); temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I am patient, diligent, result-oriented, proactive, and skillful"] = master[Constants.NEUTRAL]["I am patient, diligent, result-oriented, proactive, and skillful"]; res.Responses.Add(temp); temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I am confident, maticulous, energetic, motivated, and self-starter"] = master[Constants.NEUTRAL]["I am confident, maticulous, energetic, motivated, and self-starter"]; res.Responses.Add(temp); temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I am social, jovial, analytical, professional, and ambitious"] = master[Constants.NEUTRAL]["I am social, jovial, analytical, professional, and ambitious"]; res.Responses.Add(temp); temp = new Dictionary <string, Dictionary <string, List <string> > >(); temp["I am gloomy, brooding, listener, good direction follower, and a bit melancholy"] = master[Constants.NEUTRAL]["I am gloomy, brooding, listener, good direction follower, and a bit melancholy"]; res.Responses.Add(temp); for (int i = 0; i < 100; i++) { branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.NEUTRAL); Assert.IsTrue(branch.Equals("I am calculating, meticulous, exact, punctual, and deadly accurate")); } temp[branch] = master[Constants.NEUTRAL][branch]; res.Responses.Add(temp); branch = res.AttemptToFindNonRepeatingSpecificAvailableResponse(Constants.NEUTRAL); System.Console.WriteLine(branch); Assert.IsTrue(branch.Length == 0); }