Ejemplo n.º 1
0
    private static void subset_check_test()

    //****************************************************************************80
    //
    //  Purpose:
    //
    //    SUBSET_CHECK_TEST tests SUBSET_CHECK.
    //
    //  Licensing:
    //
    //    This code is distributed under the GNU LGPL license.
    //
    //  Modified:
    //
    //    10 January 2015
    //
    //  Author:
    //
    //    John Burkardt
    //
    {
        int n = 0;

        int[] s  = new int[1];
        int[] s1 = Array.Empty <int>()
        ;
        int[] s2 =
        {
            1, 2, 0
        }

        ;
        int[] s3 =
        {
            1, 0, 0, 1, 0
        }

        ;
        int test;

        Console.WriteLine("");
        Console.WriteLine("SUBSET_CHECK TEST");
        Console.WriteLine("  SUBSET_CHECK checks a subset.");

        for (test = 1; test <= 3; test++)
        {
            switch (test)
            {
            case 1:
                n = 0;
                s = typeMethods.i4vec_copy_new(n, s1);
                break;

            case 2:
                n = 3;
                s = typeMethods.i4vec_copy_new(n, s2);
                break;

            case 3:
                n = 5;
                s = typeMethods.i4vec_copy_new(n, s3);
                break;
            }

            bool check = Subset.subset_check(n, s);
            typeMethods.i4vec_transpose_print(n, s, "  Subset:");
            Console.WriteLine("  Check = " + check + "");
        }
    }