public void CorrectUnderlyingBuffer_For_IN_Test() { TestSetup.SetupTestingSession(); string file = "resources/filter/bug_checks/set_temp_to_in_bug.fl"; FLSetup s = new FLSetup(nameof(CorrectUnderlyingBuffer_For_IN_Test), "resources/kernel"); SerializableFLProgram p = s.Parser.Process(new FLParserInput(file)); FLProgram pp = p.Initialize(s.InstructionSet); FLBuffer b = new FLBuffer(CLAPI.MainThread, 128, 128, "TestInput"); pp.Run(CLAPI.MainThread, b, true); FLBuffer i = pp.GetActiveBuffer(false); byte[] c = CLAPI.ReadBuffer <byte>(CLAPI.MainThread, i.Buffer, (int)i.Size); for (int j = 0; j < c.Length; j++) { if (c[j] != 255) { Assert.Fail("Output does not match expected"); } } pp.FreeResources(); }
public void OpenFL_FilePathValidator_Incorrect_Test() { TestSetup.SetupTestingSession(); FLSetup setup = new FLSetup(nameof(OpenFL_FilePathValidator_Incorrect_Test), "resources/kernel"); Assert.Catch <FLProgramCheckException>(() => setup.Parser.Process( new FLParserInput("resources/filter/program_checks/filepath_validator_incorrect.fl")), "Did not detect Wrong FilePath"); setup.Dispose(); }
public void OpenFL_InstructionArgumentValidator_Correct_Test() { TestSetup.SetupTestingSession(); FLSetup setup = new FLSetup(nameof(OpenFL_InstructionArgumentValidator_Correct_Test), "resources/kernel"); setup.Parser.Process( new FLParserInput("resources/filter/program_checks/instructionargument_validator_correct.fl")); setup.Dispose(); }
public void OpenFL_RemoveUnusedBuffers_Test() { TestSetup.SetupTestingSession(); FLSetup setup = new FLSetup(nameof(OpenFL_RemoveUnusedBuffers_Test), "resources/kernel"); SerializableFLProgram ret = setup.Parser.Process( new FLParserInput("resources/filter/program_checks/optimizations/remove_unused_buffers.fl")); Assert.AreEqual(1, ret.DefinedBuffers.Count); //1 and not 0 because the "in" (input) buffer is also in the defined buffers. setup.Dispose(); }
public void OpenFL_RemoveUnusedFunctions_Test() { TestSetup.SetupTestingSession(); FLSetup setup = new FLSetup(nameof(OpenFL_RemoveUnusedFunctions_Test), "resources/kernel"); SerializableFLProgram ret = setup.Parser.Process( new FLParserInput("resources/filter/program_checks/optimizations/remove_unused_functions.fl")); Assert.AreEqual(2, ret.Functions.Count); setup.Dispose(); }
public void OpenFL_DefineScriptFile_Wrong_Test() { TestSetup.SetupTestingSession(); string file = "resources/filter/defines/test_wrong_script_invalid_file.fl"; Assert.Catch <Byt3Exception>(() => { FLParser parser = new FLParser(); Assembly asm = Assembly.GetAssembly(typeof(ASerializableBufferCreator)); parser.BufferCreator.AddBufferCreatorsInAssembly(asm); SerializableFLProgram pr = parser.Process(new FLParserInput(file)); }); }
public void OpenFL_Comments_Test() { TestSetup.SetupTestingSession(); string file = "resources/filter/comments/test.fl"; FLParser parser = new FLParser(); Assembly asm = Assembly.GetAssembly(typeof(ASerializableBufferCreator)); parser.BufferCreator.AddBufferCreatorsInAssembly(asm); SerializableFLProgram pr = parser.Process(new FLParserInput(file)); //FLFunction entryPoint = pr.EntryPoint; //Provoking an exception if main function is not found }
public void OpenFL_Defines_Test() { TestSetup.SetupTestingSession(); string file = "resources/filter/defines/test.fl"; FLParser parser = new FLParser(); Assembly asm = Assembly.GetAssembly(typeof(ASerializableBufferCreator)); parser.BufferCreator.AddBufferCreatorsInAssembly(asm); SerializableFLProgram result = parser.Process(new FLParserInput(file)); Assert.True(result.DefinedBuffers.Count == 5); Assert.True(result.DefinedBuffers.Count(x => x.Name == "in") == 1); Assert.True(result.DefinedBuffers.Count(x => x.Name == "textureD") == 1); Assert.True(result.DefinedBuffers.Count(x => x.Name == "textureC") == 1); Assert.True(result.DefinedBuffers.Count(x => x.Name == "textureB") == 1); Assert.True(result.DefinedBuffers.Count(x => x.Name == "textureA") == 1); }
public void OpenFL_DefineFile_Wrong_Test() { TestSetup.SetupTestingSession(); string file = "resources/filter/defines/test_wrong_define_invalid_file.fl"; Assert.Catch <Byt3Exception>(() => { BufferCreator bc = new BufferCreator(); FLInstructionSet iset = new FLInstructionSet(); FLProgramCheckBuilder checkBuilder = new FLProgramCheckBuilder(iset, bc); checkBuilder.AddProgramCheck(new FilePathValidator()); FLParser parser = new FLParser(iset, bc); checkBuilder.Attach(parser, true); Assembly asm = Assembly.GetAssembly(typeof(ASerializableBufferCreator)); parser.BufferCreator.AddBufferCreatorsInAssembly(asm); SerializableFLProgram pr = parser.Process(new FLParserInput(file)); }); }
public void OpenFL_WFCDefines_Wrong_Test() { TestSetup.SetupTestingSession(); string[] files = IOManager.GetFiles("resources/filter/defines/", "test_wrong_define_wfc_*.fl"); Assert.IsNotEmpty(files, "No Test FL Scripts found for " + nameof(OpenFL_WFCDefines_Wrong_Test)); foreach (string file in files) { Assert.Catch <AggregateException>(() => { FLParser parser = new FLParser(); Assembly asm = Assembly.GetAssembly(typeof(ASerializableBufferCreator)); parser.BufferCreator.AddBufferCreatorsInAssembly(asm); SerializableFLProgram pr = parser.Process(new FLParserInput(file)); }); } }
public void OpenFL_DeserializedProgram_Execution_Test() { TestSetup.SetupTestingSession(); OpenFLBenchmarks.RunDeserializedFLExecutionBenchmark("_test", GetFiles(), EXECUTION_BENCHMARK_ITERATIONS); }
public void OpenFL_Program_Initialization_Test() { TestSetup.SetupTestingSession(); OpenFLBenchmarks.RunProgramInitBenchmark("_test", GetFiles(), IO_BENCHMARK_ITERATIONS); }
public void OpenFL_Parser_Parsing_Test() { TestSetup.SetupTestingSession(); OpenFLBenchmarks.RunParserProcessBenchmark("_test", GetFiles(), IO_BENCHMARK_ITERATIONS); }
public void OpenFL_Parser_Initialization_Test() { TestSetup.SetupTestingSession(); OpenFLBenchmarks.RunParserInitBenchmark("_test", IO_BENCHMARK_ITERATIONS, "performance", true, false); }