""" Test that primitive types can be passed where interfaces such as IComparable are expected. Interfaces implemented by primitive types: int{8,16,32,64} IComparable, IConvertible, IFormattable, IComparable, IEquatable single IComparable, IConvertible, IFormattable, IComparable, IEquatable double IComparable, IConvertible, IFormattable, IComparable, IEquatable decimal IComparable, IConvertible, IFormattable, IComparable, IEquatable bool IComparable, IConvertible, IComparable, IEquatable char IComparable, IConvertible, IComparable, IEquatable """ class Test def main # int (int32) i1 as int = 47 i2 as int = 46 .checkIComparable(i1, i2) .checkIConvertible(i1, i2) assert .checkIComparableGt(i1, i2) # bool b1 = true b2 = false .checkIComparable(b1, b2) .checkIConvertible(b1, b2) # char c1 = c'0' c2 = c'1' .checkIComparable(c1, c2) .checkIConvertible(c1, c2) # float/single s1 = 10_f32 s2 = 11_f32 .checkIComparable(s1, s2) .checkIConvertible(s1, s2) # float64/double f1 = 10_f64 f2 = 11_f64 .checkIComparable(f1, f2) .checkIConvertible(f1, f2) # Decimal d1 as decimal = 99.1 d2 as decimal = 99.9 .checkIComparable(d1, d2) .checkIConvertible(d1, d2) def checkIComparableGt(a as IComparable, b as IComparable) as bool return a.compareTo(b) > 0 def checkIComparable(a as IComparable, b as IComparable) pass def checkIConvertible(a as IConvertible, b as IConvertible) pass def checkIFormattable(a as IFormattable, b as IFormattable) pass class GenCheck shared def checkIComparableG(a as IComparable, b as IComparable) pass def checkIEquatableG(a as IEquatable, b as IEquatable) pass