// This test simple ensure the correctness of the LPS method used in the preprocessing stage // in the KPM algorithm public void LanguageEngineLPS() { LangE = new GameObject(); LangE.AddComponent <LanguageEngine>(); Leng = LangE.GetComponent <LanguageEngine>(); string sample1 = "abababca"; string sample2 = "Cynthia"; int[] expectedlps1 = new int[] { 0, 0, 1, 2, 3, 4, 0, 1 }; int[] expectedlps2 = new int[] { 0, 0, 0, 0, 0, 0, 0 }; Assert.AreEqual(Leng.LPS(sample1, sample1.Length), expectedlps1); Assert.AreEqual(Leng.LPS(sample2, sample2.Length), expectedlps2); }