using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnitTestSharp; namespace Blacklight.Xna.UnitTesting { class Program { static int Main(string[] args) { if (args.Count() != 2) { System.Console.WriteLine("Will not be able to run shader tests. " + "We need the location of source and tests to run. " + "\nExample: thisassembly.exe .\\ShaderSource .\\..\\Tests\\ShaderTests"); } string output = ""; int totalTests = 0; int failedTests = 0; int failedChecks = 0; double totalTime = 0; { int totalTestsCS = 0; int failedTestsCS = 0; int failedChecksCS = 0; double time = HelperFunctions.TimeTestRun( TestRunner.SearchForAndRunAllTests, (outputString) => output += outputString, out totalTestsCS, out failedTestsCS, out failedChecksCS); totalTests += totalTestsCS; failedTests += failedTestsCS; failedChecks += failedChecksCS; totalTime += time; } if (args.Count() == 2) { UnitTestSharp.Action testRunner = delegate(Action outputHLSL, out int totalTestsFxnHLSL, out int failedTestsHLSL, out int failedChecksHLSL) { UnitTestSharpHLSL.TestRunner.RunAllTests(args[0], args[1], "fx", "fxt", new UnitTestSharpHLSL.TestRunner.AggressiveIncludeHandler(args[0]), outputHLSL, out failedChecksHLSL, out failedTestsHLSL, out totalTestsFxnHLSL); }; int totalTestsHLSL; int totalFailedChecksHLSL; int totalFailedTestsHLSL; double time = UnitTestSharp.HelperFunctions.TimeTestRun(testRunner, (outHLSL) => output += outHLSL, out totalTestsHLSL, out totalFailedTestsHLSL, out totalFailedChecksHLSL); totalTests += totalTestsHLSL; failedTests += totalFailedTestsHLSL; failedChecks += totalFailedChecksHLSL; totalTime += time; } output += "\n"; output += UnitTestSharp.TestRunner.NotifyUserOfFinalStatus(failedTests, failedChecks, totalTests) + "\n"; output += "Test Time: " + totalTime + " seconds." + "\n"; Console.WriteLine(output); return failedTests; } } }