#!/usr/bin/env ruby require_relative 'LineDeterminator' require_relative 'AnalyzedClass' require_relative 'AnalyzedClassGenerator' require_relative 'FormGenerator' class ClassAnalyzer def initialize (searchDirectoryArg, testCaseDirectoryArg, outputDirectoryOpt) @searchDirectoryArg = searchDirectoryArg @testCaseDirectoryArg = testCaseDirectoryArg @outputDirectoryOpt = outputDirectoryOpt @analyzedClasses = Array.new @analyzedTestClasses = Array.new @testedFunctionsMap = Hash.new @numProjectFiles = 0 @numTestFiles = 0 end def analyze createClassAnalysisFiles processTestFiles generator = AnalyzedTestClassGenerator.new(@analyzedClasses, @analyzedTestClasses, @testCaseDirectoryArg) @testedFunctionsMap = generator.generateAnalyzedTestClasses formGen = FormGenerator.new(@outputDirectoryOpt, @testedFunctionsMap, @analyzedClasses, @numProjectFiles, @numTestFiles) formGen.generateForm end def processTestFiles counter = 0 Dir.glob("#{@testCaseDirectoryArg}/**/*.swift") do |item| next if item == '.' or item == '..' counter += 1 analyzedClasses = AnalyzedClassGenerator.new.generateAnalyzedClassesForFile item @analyzedTestClasses += analyzedClasses if counter % 50 == 0 print "Test Swift Files processed: #{counter}\r" end end print "Test Swift files processed: #{counter}\r" puts @numTestFiles = counter end def createClassAnalysisFiles counter = 0 Dir.glob("#{@searchDirectoryArg}/**/*.swift") do |item| next if item == '.' or item == '..' counter += 1 analyzedClasses = AnalyzedClassGenerator.new.generateAnalyzedClassesForFile item @analyzedClasses += analyzedClasses if counter % 50 == 0 print "Swift Files processed: #{counter}\r" end end print "Swift Files processed: #{counter}\r" puts @numProjectFiles = counter end end