コード例 #1
0
        public IEnumerator LongTermMemoryCommit()
        {
            SetupMemory();

            // Add the first memory destined for long term memory, should go into short term
            controller.AddMemory(longTermMemory);
            Assert.NotZero(controller.GetShortTermMemoriesAbout(longTermInfluencer).Length, "There are no short term memories even after adding a memory");
            Assert.Zero(controller.GetLongTermMemories().Length, "There are long term memories in a new Memory Controller");

            // Add the second memory destined for long term memory, should go into short term
            controller.AddMemory(longTermMemory);
            Assert.AreEqual(1, controller.GetShortTermMemoriesAbout(longTermInfluencer).Length);
            Assert.Zero(controller.GetLongTermMemories().Length, "There still shouldn't be any long term memories after adding three short terms.");

            // Add one more short term memory, this should push the two destined for long term into long term to make space for the short term
            controller.AddMemory(shortTermMemory);
            Assert.AreEqual(1, controller.GetShortTermMemoriesAbout(shortTermInfluencer).Length, "There should be 3 memories about " + shortTermInfluencer.name + " short term items in short term memory at this point");
            Assert.AreEqual(1, controller.GetLongTermMemoriesAbout(longTermInfluencer).Length, "There should now be a long term memory.");

            yield return(null);
        }