Пример #1
0
 internal void Fail(String s, int start, int limit, Type exc)
 {
     try
     {
         UCharacter.CodePointCount(s, start, limit);
         Errln("unexpected success " + Str(s, start, limit));
     }
     catch (Exception e)
     {
         //if (!exc.GetTypeInfo().isInstance(e))
         if (!exc.IsAssignableFrom(e.GetType()))
         {
             Warnln("bad exception " + Str(s, start, limit)
                    + e.GetType().Name);
         }
     }
 }
Пример #2
0
            internal void Test(String s, int start, int limit, int expected)
            {
                int val1 = UCharacter.CodePointCount(s.ToCharArray(), start,
                                                     limit);
                int val2 = UCharacter.CodePointCount(s, start, limit);

                if (val1 != expected)
                {
                    Errln("char[] " + Str(s, start, limit) + "(" + val1
                          + ") != " + expected);
                }
                else if (val2 != expected)
                {
                    Errln("String " + Str(s, start, limit) + "(" + val2
                          + ") != " + expected);
                }
                else if (IsVerbose())
                {
                    Logln(Str(s, start, limit) + " == " + expected);
                }
            }