private PackageIL CompileStdLib(AdamantCompiler compiler) { try { var sourceDir = Path.Combine(SolutionDirectory.Get(), @"stdlib\src"); var sourcePaths = Directory.EnumerateFiles(sourceDir, "*.ad", SearchOption.AllDirectories); var rootNamespace = FixedList <string> .Empty; var codeFiles = sourcePaths.Select(p => LoadCode(p, sourceDir, rootNamespace)) .ToList(); return(compiler.CompilePackage("adamant.stdlib", codeFiles, FixedDictionary <Name, PackageIL> .Empty)); } catch (FatalCompilationErrorException ex) { testOutput.WriteLine("Std Lib Compiler Errors:"); foreach (var diagnostic in ex.Diagnostics) { testOutput.WriteLine( $"{diagnostic.File.Reference}:{diagnostic.StartPosition.Line}:{diagnostic.StartPosition.Column} {diagnostic.Level} {diagnostic.ErrorCode}"); testOutput.WriteLine(diagnostic.Message); } Assert.True(false, "Compilation errors in standard library"); throw new UnreachableCodeException(); } }
public void Resources_start_with_BOM(string filename) { var projectDir = Path.Combine(SolutionDirectory.Get(), "Emit.C"); var codeFileBytes = File.ReadAllBytes(Path.Combine(projectDir, filename)); AssertStartsWithUtf8Bom(codeFileBytes); }
private static Package CompileStdLib(AdamantCompiler compiler) { var sourceDir = Path.Combine(SolutionDirectory.Get(), @"stdlib\src"); var sourcePaths = Directory.EnumerateFiles(sourceDir, "*.ad", SearchOption.AllDirectories); var rootNamespace = FixedList <string> .Empty; var codeFiles = sourcePaths.Select(p => LoadCode(p, sourceDir, rootNamespace)).ToList(); return(compiler.CompilePackage("adamant.stdlib", codeFiles, FixedDictionary <string, Package> .Empty)); }
public static TheoryData <TestCase> GetConformanceTestCases() { var testCases = new TheoryData <TestCase>(); var testsDirectory = Path.Combine(SolutionDirectory.Get(), "tests"); foreach (var fullPath in Directory.EnumerateFiles(testsDirectory, "*.ad", SearchOption.AllDirectories)) { var relativePath = Path.GetRelativePath(testsDirectory, fullPath); testCases.Add(new TestCase(fullPath, relativePath)); } return(testCases); }
public Logic( IGraphProvider graphProvider, IBitmapProvider bitmapProvider, Log logger, Commands commands, ConnectionData connectionData) { GraphProvider = graphProvider; Bitmap = bitmapProvider.Bitmap; Logger = logger; Commands = commands; bitmapProvider.ShowBitmap(); graphProvider.ShowGraph(); _groundSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_05.png"), 16, 16); _waterSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_19.png"), 16, 16); _treeSprite = BitmapLoader.Load(SolutionDirectory.Get(@"Images\Shooter\Tiles\tile_183.png"), 16, 16); Commands.Login(connectionData.Host, connectionData.Port, connectionData.UserName, connectionData.Password); Logger.LogCommands = true; }
public static string GetRuntimeDirectory() { return(Path.Combine(SolutionDirectory.Get(), "tests", "runtime")); }