Example #1
0
    public static int Main(string[] args)
    {
        // Test string as [In,Out] parameter
        for (int i = 0; i < utf8Strings.Length; i++)
        {
            UTF8StringTests.TestInOutStringParameter(utf8Strings[i], i);
        }

        // Test string as [Out] parameter
        for (int i = 0; i < utf8Strings.Length; i++)
        {
            UTF8StringTests.TestOutStringParameter(utf8Strings[i], i);
        }

        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            UTF8StringTests.TestStringPassByOut(utf8Strings[i], i);
        }

        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            UTF8StringTests.TestStringPassByRef(utf8Strings[i], i);
        }


        // Test StringBuilder as [In,Out] parameter
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            UTF8StringBuilderTests.TestInOutStringBuilderParameter(utf8Strings[i], i);
        }

        // Test StringBuilder as [Out] parameter
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            UTF8StringBuilderTests.TestOutStringBuilderParameter(utf8Strings[i], i);
        }

        // utf8 string as struct fields
        UTF8StructMarshalling.TestUTF8StructMarshalling(utf8Strings);

        // delegate
        UTF8DelegateMarshalling.TestUTF8DelegateMarshalling();

        // Test StringBuilder as [Out] parameter
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            UTF8StringBuilderTests.TestReturnStringBuilder(utf8Strings[i], i);
        }

        // String.Empty tests
        UTF8StringTests.EmptyStringTest();


        return(100);
    }
Example #2
0
    public static int Main(string[] args)
    {
        // Test string as [In,Out] parameter
        for (int i = 0; i < utf8Strings.Length; i++)
        {
            if (!UTF8StringTests.TestInOutStringParameter(utf8Strings[i], i))
            {
                return(i + 1);
            }
        }

        // Test string as [Out] parameter
        for (int i = 0; i < utf8Strings.Length; i++)
        {
            if (!UTF8StringTests.TestOutStringParameter(utf8Strings[i], i))
            {
                return(i + 100);
            }
        }

        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            if (!UTF8StringTests.TestStringPassByOut(utf8Strings[i], i))
            {
                return(i + 200);
            }
        }

        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            if (!UTF8StringTests.TestStringPassByRef(utf8Strings[i], i))
            {
                return(i + 300);
            }
        }


        // Test StringBuilder as [In,Out] parameter
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            if (!UTF8StringBuilderTests.TestInOutStringBuilderParameter(utf8Strings[i], i))
            {
                return(i + 400);
            }
        }

#if NOT_YET
        // This requires support for [Out] in StringBuilder

        // Test StringBuilder as [Out] parameter
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            if (!UTF8StringBuilderTests.TestOutStringBuilderParameter(utf8Strings[i], i))
            {
                return(i + 500);
            }
        }
#endif

        // utf8 string as struct fields
        if (!UTF8StructMarshalling.TestUTF8StructMarshalling(utf8Strings))
        {
            return(600);
        }

        // delegate
        try {
            UTF8DelegateMarshalling.TestUTF8DelegateMarshalling();
        } catch (ExecutionEngineException) {
            // Known issue on AOT - we do not AOT this yet.
        }

#if NOT_YET
        // This requires special support for StringBuilder return values
        // Test StringBuilder as return value
        for (int i = 0; i < utf8Strings.Length - 1; i++)
        {
            if (!UTF8StringBuilderTests.TestReturnStringBuilder(utf8Strings[i], i))
            {
                return(700 + i);
            }
        }
#endif
        // String.Empty tests
        if (!UTF8StringTests.EmptyStringTest())
        {
            return(800);
        }

        return(0);
    }