public void JosephusI5O3()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.JosephusAlgorithm("5");
        Assert.AreEqual(joe.output.text, "3", "value was: " + joe.output.text);
    }
예제 #2
0
 static void Main()
 {
     Josephus j = new Josephus (3, 8);
     Console.WriteLine (j.GetSurvivor ());
     j = new Josephus (2323, 344);
     Console.WriteLine (j.GetSurvivor ());
 }
    public void JosephusI1O1()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.JosephusAlgorithm("1");
        Assert.That(joe.output.text.Equals("1"));
    }
    public void JosephusI2O1()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.JosephusAlgorithm("2");
        Assert.AreEqual(joe.output.text, "1");
    }
    public void JosephusOnlyAcceptsPositiveInput()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.JosephusAlgorithm("-1");
        Assert.That(joe.output.text.Equals(""));
    }
    public void JosephusTestWorks()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.output.text = "something";
        Assert.That(joe.output.text.Equals("something"), "Test works");
    }
예제 #7
0
        //[Fact]

        public void TestForKnowInput1()
        {
            string[] input = { "3 2" };
            Assert.Equal(3, Josephus.parseInputAndGetOutput(input)[0]);

            string[] input2 = { "5 3" };
            Assert.Equal(4, Josephus.parseInputAndGetOutput(input2)[0]);
        }
    public void JosephusOnlyAcceptsNumericInput()
    {
        Josephus joe = GameObject.FindObjectOfType <Josephus>();

        joe.output.text = "hi";
        joe.JosephusAlgorithm("a");
        Assert.That(joe.output.text.Equals(""));
    }
예제 #9
0
        public ActionResult Index()
        {
            int a1 = new Fibonacci().GetFibonacci(5);

            int a = 1;
            int b = 2;

            new Swap().Swap4(ref a, ref b);

            new Test_Collection().QueueOperation();
            new Test_String().Test2();
            new Test_Dictionary().Sort();
            new Test_Decimal().Round();
            new Test_Foreach().Run();
            new Test_Override().Run();

            var result  = new Josephus().GetLastOne1(41, 3);
            var result2 = new Narcissus().GetN(3);

            Response.Redirect("/ViewValue/Index?name=QueryStringName");
            return(View());
        }
 private void JosephusTest(object[] items, int k, object[] result)
 {
     Assert.AreEqual(new List <object>(result), Josephus.JosephusPermutation(new List <object>(items), k));
 }
예제 #11
0
    public static void josephus_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    JOSEPHUS_TEST tests JOSEPHUS.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    02 December 2006
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        Console.WriteLine("");
        Console.WriteLine("JOSEPHUS_TEST");
        Console.WriteLine("  JOSEPHUS solves Josephus problems.");
        Console.WriteLine("");
        Console.WriteLine("    N    M    K	 X");
        Console.WriteLine("");

        int m = 3;
        int n = 41;
        int k = 41;
        int x = Josephus.josephus(n, m, k);

        Console.WriteLine(n.ToString().PadLeft(5) + "  "
                          + m.ToString().PadLeft(5) + "  "
                          + k.ToString().PadLeft(5) + "  "
                          + x.ToString().PadLeft(5) + "");

        m = -38;
        n = 41;
        k = 41;
        x = Josephus.josephus(n, m, k);

        Console.WriteLine(n.ToString().PadLeft(5) + "  "
                          + m.ToString().PadLeft(5) + "  "
                          + k.ToString().PadLeft(5) + "  "
                          + x.ToString().PadLeft(5) + "");

        m = 3;
        n = 41;
        k = 40;
        x = Josephus.josephus(n, m, k);

        Console.WriteLine(n.ToString().PadLeft(5) + "  "
                          + m.ToString().PadLeft(5) + "  "
                          + k.ToString().PadLeft(5) + "  "
                          + x.ToString().PadLeft(5) + "");

        m = 2;
        n = 64;
        k = 64;
        x = Josephus.josephus(n, m, k);

        Console.WriteLine(n.ToString().PadLeft(5) + "  "
                          + m.ToString().PadLeft(5) + "  "
                          + k.ToString().PadLeft(5) + "  "
                          + x.ToString().PadLeft(5) + "");

        m = 2;
        n = 1000;
        k = 1000;
        x = Josephus.josephus(n, m, k);

        Console.WriteLine(n.ToString().PadLeft(5) + "  "
                          + m.ToString().PadLeft(5) + "  "
                          + k.ToString().PadLeft(5) + "  "
                          + x.ToString().PadLeft(5) + "");
    }