Sha256: 2c94e6a39d776be5b6ae0f031e7fed2de3ce67ee5c4c35f4fde71681f63f0b6b

Contents?: true

Size: 1.92 KB

Versions: 1

Compression:

Stored size: 1.92 KB

Contents

#!/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


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dftcc-0.1.0 lib/ClassAnalyzer.rb