Example #1
0
        public void All_solutions_same()
        {
            var logins      = PasscodeDerivation.KeyLog.Lines();
            var edSolution  = PasscodeDerivation.ShortestPhrase(logins).ToString();
            var kevSolution = Week1.Computeaverage(logins);
            var leeSolution = LeeSolution.Compute(logins);

            Assert.AreEqual(edSolution, kevSolution);
            Assert.AreEqual(edSolution, leeSolution);
        }
Example #2
0
        public void Ed_speed_of_alogithm()
        {
            var logins = PasscodeDerivation.KeyLog.Lines();

            StatsCollection result = LinqPadUX.Measure.Action(() => PasscodeDerivation.ShortestPhrase(logins));

            var builder = new StringBuilder();

            result.WriteReportTable(new StringWriter(builder), 1f);

            var temporaryFile = FileUtility.GetTemporaryFile(".html");

            File.WriteAllText(temporaryFile, builder.ToString());
            System.Diagnostics.Process.Start(temporaryFile);
            //File.Delete(temporaryFile);
        }
Example #3
0
        public void key_log_txt()
        {
            var logins = PasscodeDerivation.KeyLog.Lines();

            Assert.That(PasscodeDerivation.ShortestPhrase(logins), Is.EqualTo(73162890));
        }
Example #4
0
        public void two_iterations()
        {
            var logins = new string[] { "680", "180" };

            Assert.That(PasscodeDerivation.ShortestPhrase(logins), Is.EqualTo(1680));
        }