public void CheckConvert(int expect_from, int expect_to, TypeConverter conv, Type type) {
int from_count = 0;
int to_count = 0;
foreach (Type t in typeof(int).Assembly.GetTypes ()) {
if (conv.CanConvertFrom(null, t)) {
from_count++;
if (debug > 0) {
Console.WriteLine("{0}: Conversion from {1} supported", conv.ToString(), t.ToString());
}
}
if (conv.CanConvertTo(null, t)) {
to_count++;
if (debug > 0) {
Console.WriteLine("{0}: Conversion to {1} supported", conv.ToString(), t.ToString());
}
}
}
#if not
foreach (Type t in type.Assembly.GetTypes ()) {
if (conv.CanConvertFrom(null, t)) {
from_count++;
if (debug > 0) {
Console.WriteLine("{0}: Conversion from {1} supported", conv.ToString(), t.ToString());
}
}
if (conv.CanConvertTo(null, t)) {
to_count++;
if (debug > 0) {
Console.WriteLine("{0}: Conversion to {1} supported", conv.ToString(), t.ToString());
}
}
}
#endif
if (from_count != expect_from) {
if (verbose > 0) {
Console.WriteLine("{0}: ConvertFrom expected {1}, returned {2}", conv.ToString(), expect_from, from_count);
}
failed++;
}
if (to_count != expect_to) {
if (verbose > 0) {
Console.WriteLine("{0}: ConvertTo expected {1}, returned {2}", conv.ToString(), expect_to, to_count);
}
failed++;
}
}