| 1 | # int primitive aliasType not cogniscent of interfaces of Int* |
| 2 | # Also missing on other aliasTypes but this only exercises |
| 3 | # IComparable, IConvertible |
| 4 | # full set of interfaces on aliases to check is |
| 5 | # int{8,16,32,64} IComparable, IConvertible, IFormattable IComparable<int>, IEquatable<int>, |
| 6 | # single IComparable, IConvertible, IFormattable IComparable<float>, IEquatable<float>, |
| 7 | # double IComparable, IConvertible, IFormattable IComparable<double>, IEquatable<double> |
| 8 | # decimal IComparable, IConvertible, IFormattable IComparable<decimal>, IEquatable<decimal> |
| 9 | |
| 10 | # bool IComparable, IConvertible, IComparable<bool>, IEquatable<bool>, |
| 11 | # char IComparable, IConvertible, IComparable<bool>, IEquatable<bool>, |
| 12 | |
| 13 | class IntNotIComp |
| 14 | def main |
| 15 | |
| 16 | # int (int32) |
| 17 | i as int = 47 |
| 18 | i1 as int = 46 |
| 19 | .checkIComparable(i, i1) |
| 20 | .checkIConvertible(i, i1) |
| 21 | #b = .checkICompGt(i, i1) # was compile error here |
| 22 | #assert b |
| 23 | #print b |
| 24 | |
| 25 | # bool |
| 26 | b = true |
| 27 | b1 = false |
| 28 | .checkIComparable(b, b1) |
| 29 | .checkIConvertible(b, b1) |
| 30 | |
| 31 | # char |
| 32 | c = c'0' |
| 33 | c1 = c'1' |
| 34 | .checkIComparable(c, c1) |
| 35 | .checkIConvertible(c, c1) |
| 36 | |
| 37 | # float/single |
| 38 | s = 10f |
| 39 | s1 = 11f |
| 40 | .checkIComparable(s, s1) |
| 41 | .checkIConvertible(s, s1) |
| 42 | |
| 43 | # float64/double |
| 44 | d as float64 = 10f64 |
| 45 | d1 as float64 = 11f64 |
| 46 | .checkIComparable(d, d1) |
| 47 | .checkIConvertible(d, d1) |
| 48 | |
| 49 | # Decimal |
| 50 | dc as decimal = 99.1 |
| 51 | dc1 as decimal = 99.9 |
| 52 | .checkIComparable(dc, dc1) |
| 53 | .checkIConvertible(dc, dc1) |
| 54 | |
| 55 | |
| 56 | def checkICompGt(i as IComparable, i1 as IComparable) as bool |
| 57 | if i.compareTo(i1) >0, return true |
| 58 | return false |
| 59 | |
| 60 | def checkIComparable(i as IComparable, i1 as IComparable) |
| 61 | pass |
| 62 | |
| 63 | def checkIConvertible(i as IConvertible, i1 as IConvertible) |
| 64 | pass |
| 65 | |
| 66 | #NYI |
| 67 | def checkIFormattable(f as IFormattable, f1 as IFormattable) |
| 68 | pass |
| 69 | |
| 70 | class GenChk<of T> |
| 71 | shared |
| 72 | def checkIComparableG(i as IComparable<of T>, i1 as IComparable<of T>) |
| 73 | pass |
| 74 | |
| 75 | def checkIEquatableG(e as IEquatable<of T>, e1 as IEquatable<of T>) |
| 76 | pass |
| 77 | # use as GenChk<of int>.checkIComparableG(i, i1) |
| 78 | # use as GenChk<of bool>.checkIComparableG(b, b1) |
| 79 | #... |