require "take/unit/predict_match" require "take/unit/ast" require "take/unit/compiler" require "take/unit/scanner" require "take/unit/generator" module Take # A unit test. This is used to generate c files for tests. class Unit def self.create(file) file = File.open(file, "r") scanner = Scanner.new(file.read) compiler = Compiler.new(file.path, scanner.scan) generator = Generator.new(compiler.compile, directory: File.dirname(file.path)).tap(&:generate) generator.write_file(file.path.gsub(/\..*\z/, ".c") end end end