Esempio n. 1
0
        protected void Run(bool runTestsViewOut, string pspAutoTestsFolder, string wildCardFilter)
        {
            foreach (var fileNameExpected in Directory.GetFiles(pspAutoTestsFolder, "*.expected",
                                                                SearchOption.AllDirectories))
            {
                var fileNameBaseBase   = Path.GetFileNameWithoutExtension(fileNameExpected);
                var fileNameBase       = Path.GetDirectoryName(fileNameExpected) + @"\" + fileNameBaseBase;
                var fileNameExecutable = fileNameBase + ".prx";
                var fileNameSourceCode = fileNameBase + ".c";

                var matchName = fileNameBase.Substr(pspAutoTestsFolder.Length).Replace("\\", "/");

                //Console.WriteLine(MatchName + " ~ " + Wildcard.WildcardToRegex(WildCardFilter));
                if (!new Regex(Wildcard.WildcardToRegex(wildCardFilter)).IsMatch(matchName))
                {
                    continue;
                }

                var recompile = false;
                //bool Recompile = true;

                if (File.GetLastWriteTime(fileNameExecutable) != File.GetLastWriteTime(fileNameSourceCode))
                {
                    recompile = true;
                }

#if ENABLE_RECOMPILE
                if (recompile)
                {
                    //PspAutoTestsFolder + @"\make.bat"
                    // FileNameBase
                    try { File.Delete(FileNameExecutable); } catch (Exception e) { Console.WriteLine(e); }
                    var Output = ExecuteBat(PspAutoTestsFolder + @"\build.bat", FileNameBase);
                    if (!string.IsNullOrEmpty((Output)))
                    {
                        Console.Write("Compiling {0}...", FileNameBase);
                        Console.WriteLine("Result:");
                        Console.WriteLine("{0}", Output);
                    }
                    try
                    {
                        File.SetLastWriteTime(FileNameExecutable, File.GetLastWriteTime(FileNameSourceCode));
                    }
                    catch
                    {
                    }
                }
#endif

                if (File.Exists(fileNameExecutable))
                {
                    RunFile(runTestsViewOut, pspAutoTestsFolder, fileNameExecutable, fileNameExpected, fileNameBase);
                }
                else
                {
                    Console.WriteLine("Can't find executable for '{0}' '{1}'", fileNameExpected, fileNameExecutable);
                }
            }
        }
Esempio n. 2
0
        static protected void Run(string PspAutoTestsFolder, string WildCardFilter)
        {
            foreach (var FileNameExpected in Directory.GetFiles(PspAutoTestsFolder, "*.expected", SearchOption.AllDirectories))
            {
                var FileNameBaseBase   = Path.GetFileNameWithoutExtension(FileNameExpected);
                var FileNameBase       = Path.GetDirectoryName(FileNameExpected) + @"\" + FileNameBaseBase;
                var FileNameExecutable = FileNameBase + ".elf";
                var FileNameSourceCode = FileNameBase + ".c";

                var MatchName = FileNameBase.Substr(PspAutoTestsFolder.Length).Replace("\\", "/");

                //Console.WriteLine(MatchName + " ~ " + Wildcard.WildcardToRegex(WildCardFilter));
                if (!new Regex(Wildcard.WildcardToRegex(WildCardFilter)).IsMatch(MatchName))
                {
                    continue;
                }

                bool Recompile = false;
                //bool Recompile = true;

                if (File.GetLastWriteTime(FileNameExecutable) != File.GetLastWriteTime(FileNameSourceCode))
                {
                    Recompile = true;
                }

                if (Recompile)
                {
                    //PspAutoTestsFolder + @"\make.bat"
                    // FileNameBase
                    try { File.Delete(FileNameExecutable); } catch { }
                    var Output = ExecuteBat(PspAutoTestsFolder + @"\make_silent.bat", FileNameBase);
                    if (Output != "")
                    {
                        Console.Write("Compiling {0}...", FileNameBase);
                        Console.WriteLine("Result:");
                        Console.WriteLine("{0}", Output);
                    }
                    try
                    {
                        File.SetLastWriteTime(FileNameExecutable, File.GetLastWriteTime(FileNameSourceCode));
                    }
                    catch
                    {
                    }
                }

                if (File.Exists(FileNameExecutable))
                {
                    RunFile(PspAutoTestsFolder, FileNameExecutable, FileNameExpected);
                }
                else
                {
                    Console.WriteLine("Can't find executable for '{0}' '{1}'", FileNameExpected, FileNameExecutable);
                }
            }
        }
Esempio n. 3
0
    public void WildcardTest()
    {
        var input    = @"https://www.facebook.com/name.surname/photos_albums";
        var wildcard = @"https://www.facebook.com/*/photos_albums";
        var expected = @"name.surname";

        Wildcard wc = new Wildcard(wildcard);

        var regex   = Wildcard.WildcardToRegex(wildcard);
        var matches = SH.SplitAndReturnRegexMatches(input, new System.Text.RegularExpressions.Regex(regex));

        int i = 0;

        #region Not working
        //var matches = wc.Matches(input);

        //var first = matches[0];
        //Assert.Equal(expected, first.Value);
        #endregion
    }
Esempio n. 4
0
    public void WildcardTest1()
    {
        var input    = "<M C=\"a\">";
        var wildcard = @"";
        var expected = @"name.surname";

        Wildcard wc = new Wildcard(wildcard);

        var regex   = Wildcard.WildcardToRegex(wildcard);
        var matches = SH.SplitAndReturnRegexMatches(input, new System.Text.RegularExpressions.Regex(regex));

        int i = 0;

        #region Not working
        //var matches = wc.Matches(input);

        //var first = matches[0];
        //Assert.Equal(expected, first.Value);
        #endregion
    }