示例#1
0
        private void ExecuteRunTest(object sender, EventArgs e)
        {
            RunTests test = new RunTests();

            test.CheckRun_MK82();
            test.CheckRun_Ball();
        }
        public void RunTests(RunTests command, ITestResultReceiver reporter)
        {
            _assemblyLoaderProxy.AddDirectory(command.AssemblyPath);
            var ourProxy = new TestResultReporter(reporter);

            _runnerProxy.RunTest(command, ourProxy);
        }
示例#3
0
        static void Tests()
        {
            Console.WriteLine("Running tests... (a small number of them are broken)");

            // Workaround for MS bug: Assert(false) will not fire in debugger
            Debug.Listeners.Clear();
            Debug.Listeners.Add(new DefaultTraceListener());

            RunTests.Run(new IntSetTests());
            //RunTests.Run(new LNodeTests());
            RunTests.Run(new LlpgParserTests());
            RunTests.Run(new LlpgGeneralTests());
            RunTests.Run(new Loyc.Syntax.Lexing.TokenTests());
            RunTests.Run(new Loyc.Syntax.Les.LesLexerTests());
            RunTests.Run(new Loyc.Syntax.Les.LesParserTests());
            RunTests.Run(new Loyc.Syntax.Les.LesPrinterTests());
            RunTests.Run(new LexerSourceTests_Calculator());
            RunTests.Run(new ParserSourceTests_Calculator());
            RunTests.Run(new LeMP.MacroProcessorTests());
            RunTests.Run(new LeMP.StandardMacroTests());
            RunTests.Run(new LlpgCoreTests());
            RunTests.Run(new LlpgAutoValueSaverVisitorTests());
            RunTests.Run(new LlpgTestLargerExamples());
            RunTests.Run(new LlpgBugsAndSlugs());
            RunTests.Run(new Loyc.Syntax.Lexing.TokensToTreeTests());
            RunTests.Run(new Loyc.Syntax.Les.LesPrinterTests());
        }
示例#4
0
        private static void RunInAppDomain(IFrameworkHandle frameworkHandle, IGrouping <string, TestCase> source, List <TestCase> tests)
        {
            var dir = Path.GetDirectoryName(source.Key);
            var cmd = new RunTests
            {
                AssemblyName = Path.GetFileName(source.Key), AssemblyPath = dir, Source = source.Key,
            };
            var dto = new List <TestCaseToRun>();

            foreach (TestCase testCase in tests)
            {
                var parts = testCase.FullyQualifiedName.Split('.');
                dto.Add(new TestCaseToRun(testCase.FullyQualifiedName)
                {
                    TestClassName  = parts[parts.Length - 2],
                    TestMethodName = parts[parts.Length - 1]
                });
            }

            using (var appDomainRunner = new AppDomainRunner(source.Key))
            {
                appDomainRunner.AddDirectory(dir);
                appDomainRunner.Create();


                var resultProxy = new TestResultProxy(frameworkHandle, tests);
                appDomainRunner.RunTests(cmd, resultProxy);
            }
        }
示例#5
0
文件: Program.cs 项目: dadhi/ecsharp
 public static int Test_LeMP()
 {
     return(RunTests.RunMany(
                new MacroProcessorTests(),
                new PreludeMacroTests_Les2(),
                new PreludeMacroTests_Les3(),
                new CompilerTests(),
                new SmallerMacroTests(),
                new LiteralTests(),
                new TestAlgebraicDataTypes(),
                new TestCodeContractMacros(),
                new TestCodeQuoteMacro(),
                new TestMacroCombinations(),
                new TestMatchCodeMacro(),
                new TestStaticMatchCodeMacro(),
                new TestStaticDeconstructMacro(),
                new TestMatchMacro(),
                new TestOnFinallyReturnThrowMacros(),
                new TestReplaceAndDefineMacros(),
                new TestUseSequenceExpressionsMacro(),
                new TestSetOrCreateMemberMacro(),
                new TestUnrollMacro(),
                new TestUseSymbolsMacro(),
                new TestCompileTimeMacros(),
                new TestUserDefinedMacroMacro()));
 }
示例#6
0
 public static void Test_Ecs()
 {
     RunTests.Run(new EcsLexerTests());
     RunTests.Run(new EcsParserTests());
     RunTests.Run(new EcsNodePrinterTests());
     RunTests.Run(new EcsValidatorTests());
 }
    public static void Main(string[] args)
    {
        if (args.Length == 0)
        {
            Console.WriteLine("Usage:");
            Console.WriteLine("    COMMAND run-tests");
            Console.WriteLine("    COMMAND hash-file <path>");
            return;
        }

        var sub     = args[0];
        var subArgs = new string[args.Length - 1];

        Array.Copy(args, 1, subArgs, 0, subArgs.Length);

        if (sub == "run-tests")
        {
            RunTests.SubMain(subArgs);
        }
        else if (sub == "hash-file")
        {
            HashFile.SubMain(subArgs);
        }
        else
        {
            Console.Error.WriteLine("Unknown sub-command: \"{0}\".", sub);
            Environment.Exit(1); return;
        }
    }
示例#8
0
 static void Main(string[] args)
 {
     Console.WriteLine("Running VList unit tests...");
     RunTests.Run(new RWListTests());
     RunTests.Run(new WListTests());
     RunTests.Run(new RVListTests());
     RunTests.Run(new VListTests());
 }
示例#9
0
        public MainPage(bool alone, string id, string url, string[] dlls)
        {
            InitializeComponent();

            _runTest = new RunTests(Output);

            var thread = new Thread(() => RunTests(alone, id, url, dlls));

            thread.Start();
        }
示例#10
0
        public static int Test_LLLPG()
        {
            Console.WriteLine("Running LLLPG tests...");

            return(RunTests.RunMany(
                       new LlpgParserTests(),
                       new LlpgGeneralTests(),
                       new LlpgCoreTests(),
                       new LlpgAutoValueSaverVisitorTests(),
                       new LlpgTestLargerExamples(),
                       new LlpgBugsAndSlugs()));
        }
示例#11
0
        public static void Test_LLLPG()
        {
            Console.WriteLine("Running tests... (a small number of them are broken)");

            // Workaround for MS bug: Assert(false) will not fire in debugger
            Debug.Listeners.Clear();
            Debug.Listeners.Add(new DefaultTraceListener());

            RunTests.Run(new LlpgParserTests());
            RunTests.Run(new LlpgGeneralTests());
            RunTests.Run(new LlpgCoreTests());
            RunTests.Run(new LlpgAutoValueSaverVisitorTests());
            RunTests.Run(new LlpgTestLargerExamples());
            RunTests.Run(new LlpgBugsAndSlugs());
        }
示例#12
0
        private static List <TestInfo> GetTestList(IEnumerable <string> dlls)
        {
            var testList = new List <TestInfo>();

            // Find tests in the test dlls.
            foreach (var testDll in dlls)
            {
                testList.AddRange(RunTests.GetTestInfos(testDll));
            }

            // Sort tests alphabetically.
            testList.Sort((x, y) => String.CompareOrdinal(x.TestMethod.Name, y.TestMethod.Name));

            return(testList);
        }
示例#13
0
        public static void Main(string[] args)
        {
            // Copied from LoycCore.Tests' Program.cs.
            // =======================================
            // Workaround for MS bug: Assert(false) will not fire in debugger
            Debug.Listeners.Clear();
            Debug.Listeners.Add(new DefaultTraceListener());

            // ========================================

            // Round-trip fuzz tests
            RunTests.Run(new RoundTripTests());
            // LES comparison benchmark
            RunTests.Run(new LesComparisonBenchmark());

            Console.WriteLine("Job's done.");
        }
示例#14
0
        static void Main(string[] args)
        {
            // Note 1: benchmark should run first in order to measure the time it
            // takes to use GoInterface for the first time, which is the slowest.
            // Note 2: Release builds run a bit faster
            Console.WriteLine("Running GoInterface benchmark");
            Console.WriteLine();
            GoInterfaceBenchmark.DoBenchmark();

            Console.WriteLine();
            Console.WriteLine("Running GoInterface test suite");
            Console.WriteLine();
            RunTests.Run(new GoInterfaceTests());

            Console.WriteLine();
            Console.WriteLine("Press any key.");
            Console.ReadKey(true);
        }
示例#15
0
 public static int Test_LeMP()
 {
     return(RunTests.RunMany(
                new MacroProcessorTests(),
                new PreludeMacroTests(),
                new SmallerMacroTests(),
                new TestAlgebraicDataTypes(),
                new TestCodeContractMacros(),
                new TestCodeQuoteMacro(),
                new TestMacroCombinations(),
                new TestMatchCodeMacro(),
                new TestMatchMacro(),
                new TestOnFinallyReturnThrowMacros(),
                new TestReplaceMacro(),
                new TestSequenceExpressionMacro(),
                new TestSetOrCreateMemberMacro(),
                new TestUnrollMacro()));
 }
示例#16
0
        public static void Main(string[] args)
        {
            BMultiMap <string, string> options = new BMultiMap <string, string>();

            var argList = args.ToList();

            UG.ProcessCommandLineArguments(argList, options, "", ShortOptions, TwoArgOptions);
            if (!options.ContainsKey("nologo"))
            {
                Console.WriteLine("LeMP macro compiler (pre-alpha)");
            }

            string _;

            if (options.TryGetValue("help", out _) || options.TryGetValue("?", out _))
            {
                ShowHelp(KnownOptions.OrderBy(p => p.Key));
                return;
            }

            Severity minSeverity = Severity.Note;

                        #if DEBUG
            minSeverity = Severity.Debug;
                        #endif
            var filter = new SeverityMessageFilter(MessageSink.Console, minSeverity);

            Compiler c = ProcessArguments(argList, options, filter, typeof(Macros));
            Compiler.WarnAboutUnknownOptions(options, MessageSink.Console, KnownOptions);
            if (c != null)
            {
                c.MacroProcessor.PreOpenedNamespaces.Add(GSymbol.Get("LeMP.Prelude"));
                using (LNode.PushPrinter(Ecs.EcsNodePrinter.PrintPlainCSharp))
                    c.Run();
            }
            else if (args.Length == 0)
            {
                Console.WriteLine("Running unit tests...");
                RunTests.Run(new Loyc.Syntax.Les.LesLexerTests());
                RunTests.Run(new Loyc.Syntax.Les.LesParserTests());
                RunLeMPTests();
                Ecs.Program.RunEcsTests();
            }
        }
示例#17
0
        // Load a list of tests specified on the command line as a comma-separated list.  Any name prefixed with '@'
        // is a file containing test names separated by white space or new lines, with '#' indicating a comment.
        private static List <string> LoadList(string testList)
        {
            var inputList  = testList.Split(',');
            var outputList = new List <string>();

            // Check for empty list.
            if (inputList.Length == 1 && inputList[0] == "")
            {
                return(outputList);
            }

            foreach (var name in inputList)
            {
                if (name.StartsWith("@"))
                {
                    var file  = name.Substring(1);
                    var lines = File.ReadAllLines(file);
                    foreach (var line in lines)
                    {
                        // remove comments
                        var lineParts = line.Split('#');
                        if (lineParts.Length > 0 && lineParts[0] != "")
                        {
                            // split multiple test names in one line
                            outputList.AddRange(lineParts[0].Trim().Split(' ', '\t'));
                        }
                    }
                }
                else if (name.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase))
                {
                    foreach (var testInfo in RunTests.GetTestInfos(name))
                    {
                        outputList.Add(testInfo.TestClassType.Name + "." + testInfo.TestMethod.Name);
                    }
                }
                else
                {
                    outputList.Add(name);
                }
            }

            return(outputList);
        }
示例#18
0
        public void RunTest(RunTests instruction, TestResultReporter reporter)
        {
            var name     = new AssemblyName(instruction.AssemblyName);
            var assembly = Assembly.Load(name);

            try
            {
                var discoverer = new TestDiscoverer();
                discoverer.Load(assembly, instruction.Source);

                WrapRun(instruction, reporter, discoverer, assembly);
            }
            catch (Exception ex)
            {
                reporter.AddResult(new TestResult(instruction.TestCases[0])
                {
                    ErrorStackTrace = ex.StackTrace,
                    ErrorMessage    = ex.Message,
                    Result          = TestOutcome.Failed,
                });
            }
        }
示例#19
0
    public static void SubMain(string[] args)
    {
        if (args.Length != 1)
        {
            Console.Error.WriteLine("The hash-file sub-command expects exactly one argument, got " + args.Length + ".");
            Environment.Exit(1); return;
        }

        string fn = args[0];

        var hasher = new DropboxContentHasher();

        byte[] buf = new byte[1024];
        using (var file = File.OpenRead(fn))
        {
            while (true)
            {
                int n = file.Read(buf, 0, buf.Length);
                if (n <= 0)
                {
                    break;          // EOF
                }
                hasher.TransformBlock(buf, 0, n, buf, 0);
            }
        }

        hasher.TransformFinalBlock(Array.Empty <byte>(), 0, 0);
        string hexHash = DropboxContentHasher.ToHex(hasher.Hash);

        Console.WriteLine(hexHash);

        byte[] all = File.ReadAllBytes(fn);
        Console.WriteLine(DropboxContentHasher.ToHex(RunTests.ReferenceHasher(all, all.Length)));
        hasher = new DropboxContentHasher();
        hasher.TransformBlock(all, 0, all.Length, all, 0);
        hasher.TransformFinalBlock(Array.Empty <byte>(), 0, 0);
        Console.WriteLine(DropboxContentHasher.ToHex(hasher.Hash));
    }
示例#20
0
        static async Task Main(string[] args)
        {
            var discoverer = new TestDiscoverer();

            discoverer.Load(new[] { typeof(IncidentWrapper).Assembly });
            var runner = new TestRunner(discoverer);

            runner.Load(new[] { typeof(IncidentWrapper).Assembly }).GetAwaiter().GetResult();
            var result = runner.RunAll().GetAwaiter().GetResult();
            var faulty = result.Where(x => !x.IsSuccess).ToList();

            var cmd = new RunTests
            {
                AssemblyName = typeof(EnvironmentTests).Assembly.GetName().Name,
                AssemblyPath = Path.GetDirectoryName(typeof(EnvironmentTests).Assembly.Location),
                //TestCases = new[]
                //{
                //    new TestCaseToRun("Coderr.IntegrationTests.Core.TestCases.EnvironmentTests.Clearing_environment_should_remove_all_incidents_in_it")
                //    {
                //        TestClassName = "EnvironmentTests",
                //        TestMethodName = "Clearing_environment_should_remove_all_incidents_in_it"
                //    },
                //},
                Source = typeof(EnvironmentTests).Assembly.Location
            };

            var receiver = new ConsoleReceiver();

            using (var coordinator = new AppDomainRunner("TesTSuite1"))
            {
                coordinator.Create();
                coordinator.AddDirectory(
                    @"C:\src\1tcompany\coderr\oss\Coderr.Server\src\Tools\Coderr.IntegrationTests\Coderr.IntegrationTests\bin\Debug\net461");
                coordinator.RunTests(cmd, receiver);
            }
        }
示例#21
0
        public MainPage(bool alone, string id, string url, string[] dlls)
        {
            InitializeComponent();

            _runTest = new RunTests(Output);

            var thread = new Thread(() => RunTests(alone, id, url, dlls));
            thread.Start();
        }