public void MakeFullAutomata(byte[] a_tab, byte[] b_tab, params byte[][] expectedTabs) { int size = a_tab.Length; List <byte>[] TransitionsFromA = new List <byte> [size]; List <byte>[] helpList = new List <byte> [size]; for (byte i = 0; i < size; i++) { TransitionsFromA[i] = new List <byte>(); } IOptionalAutomaton a = new OptionalAutomaton(a_tab, b_tab); MakingFullAutomata makingFullAutomata = new MakingFullAutomata(a, TransitionsFromA, helpList); IEnumerable <IOptionalAutomaton> FullAutomata = makingFullAutomata.Generate(); IEnumerable <IOptionalAutomaton> FullAutomataIncremental = makingFullAutomata.Generate(); var fullIterator = FullAutomata.GetEnumerator(); var fullIncrementalIterator = FullAutomataIncremental.GetEnumerator(); while (fullIterator.MoveNext()) { fullIncrementalIterator.MoveNext(); for (int i = 0; i < fullIterator.Current.TransitionFunctionsB.Length; i++) { Assert.Equal(fullIterator.Current.TransitionFunctionsB[i], fullIncrementalIterator.Current.TransitionFunctionsB[i]); } } Assert.False(fullIncrementalIterator.MoveNext()); }
public void CheckIfDifferentFullFromAcAutomataRecursively(byte[] a_tab, byte[] b_tab) { int size = a_tab.Length; List <byte>[] TransitionsFromA = new List <byte> [size]; List <byte>[] helpList = new List <byte> [size]; for (byte i = 0; i < size; i++) { TransitionsFromA[i] = new List <byte>(); } IOptionalAutomaton Ac = new OptionalAutomaton(a_tab, b_tab); MakingFullAutomata makingFullAutomata = new MakingFullAutomata(Ac, TransitionsFromA, helpList); IEnumerable <IOptionalAutomaton> FullAutomata = makingFullAutomata.Generate(); IEnumerable <byte[]> fullAutomata2 = from a in FullAutomata select CopyArray(a.TransitionFunctionsB); byte[][] bTransitions = fullAutomata2.ToArray(); for (int i = 0; i < bTransitions.Length - 1; i++) { for (int j = i + 1; j < bTransitions.Length; j++) { Assert.NotEqual(bTransitions[i], bTransitions[j]); } } }
public void VerifyMatchingIterativeGeneration(byte[] a_tab, byte[] b_tab, params byte[][] expectedTabs) { IOptionalAutomaton a = new OptionalAutomaton(a_tab, b_tab); int size = a_tab.Length; List <byte>[] TransitionsFromA = new List <byte> [size]; List <byte>[] helpList = new List <byte> [size]; for (byte i = 0; i < size; i++) { TransitionsFromA[i] = new List <byte>(); } MakingFullAutomata makingFullAutomata = new MakingFullAutomata(a, TransitionsFromA, helpList); IEnumerable <IOptionalAutomaton> FullAutomata = makingFullAutomata.Generate(); IEnumerable <byte[]> AcAutomataBTransform = from automata in FullAutomata select CopyArray(automata.TransitionFunctionsB); IsTheSame(expectedTabs, AcAutomataBTransform); }