public void DataStructureExtractor_ExtractsRegionsForOperations_PerformsCorrectly(string codeInput, Dictionary <string, int> operationRegions) { var codeVisitor = new DataStructureExtractor(); codeVisitor.Visit(codeInput); foreach (var operationRegion in operationRegions) { //Assert.AreEqual(operationRegion.Value, codeVisitor.DataStructure.GetValue("_methodInternalCodes").Invoke(operationRegion.Key).Count); } }
public void DataStructureExtractor_ExtractsDataStructure_PerformsCorrectly(string codeInput, string[] globalVariables, Structure[] structures, Method[] methods) { var codeVisitor = new DataStructureExtractor(); codeVisitor.Visit(codeInput); Assert.True(globalVariables.All(x => codeVisitor.DataStructure.HasGlobalVariable(x))); Assert.True(structures.All(x => codeVisitor.DataStructure.Structures.Contains(x))); foreach (var operation in methods) { Assert.True(codeVisitor.DataStructure.Operations.Contains(operation)); } }
public void CodeGenerator_GeneratesEqualitySelectionDeclarations_Correctly(string codeInput, string[] declarations) { var extractor = new DataStructureExtractor(); extractor.Visit(codeInput); var typeService = new TypeService(extractor.DataStructure); var generationService = new RelationService(extractor.DataStructure, typeService); var codeGenerator = new CodeGenerator(extractor.DataStructure, generationService); codeGenerator.Visit(codeInput); Console.WriteLine(codeInput); Console.WriteLine("===================="); Console.WriteLine(codeGenerator.CodeOutput); foreach (var declaration in declarations) { Assert.True(codeGenerator.CodeOutput.Contains(declaration)); } }