Exemple #1
0
 protected private override void convertSpanImpl(ReadOnlySpan <string?> src, Span <bool> dst)
 {
     for (int i = 0; i < src.Length; i++)
     {
         dst[i] = ASString.AS_toBoolean(src[i]);
     }
 }
Exemple #2
0
        public void convertFromStringTest_array(string[] data)
        {
            runConvertArrayTest <string, int>(data, x => ASString.AS_toInt(x));
            runConvertArrayTest <string, uint>(data, x => ASString.AS_toUint(x));
            runConvertArrayTest <string, double>(data, x => ASString.AS_toNumber(x), AssertHelper.floatIdentical);
            runConvertArrayTest <string, bool>(data, x => ASString.AS_toBoolean(x));
            runConvertArrayTest <string, string>(data, x => x);

            runConvertArrayTest <string, ASObject>(data, x => x, (expected, actual) => {
                if (expected != null)
                {
                    Assert.IsType <ASString>(actual);
                    Assert.Equal((string)expected, (string)actual);
                }
                else
                {
                    Assert.Null(actual);
                }
            });

            runConvertArrayTest <string, ASAny>(data, x => x, (expected, actual) => {
                if (expected.value != null)
                {
                    Assert.IsType <ASString>(actual.value);
                    Assert.Equal((string)expected, (string)actual);
                }
                else
                {
                    AssertHelper.identical(ASAny.@null, actual);
                }
            });

            runConvertArrayTest(data, invalidConversion <string, GenericTypeConvertersTest_CA>);
            runConvertArrayTest(data, invalidConversion <string, GenericTypeConvertersTest_IA>);
            runConvertArrayTest(data, invalidConversion <string, GenericTypeConvertersTest_NonASType1>);
        }
Exemple #3
0
 public override bool convert(string?value) => ASString.AS_toBoolean(value);