1 module test; 2 3 import core.time : Duration; 4 import std.datetime : Date, DateTime, SysTime, TimeOfDay; 5 6 export string parameterlessFunction() { 7 return "Parameterless Function"; 8 } 9 10 export int freeFunction (int value) { 11 return value; 12 } 13 14 export string stringFunction(string value) nothrow { 15 return value; 16 } 17 18 export s2[] rangeFunction(s2[] arr) { 19 return arr.dup; 20 } 21 22 export c1[] classRangeFunction(c1[] arr) { 23 return arr.dup; 24 } 25 26 export string testErrorMessage(bool throwException) { 27 if(throwException) 28 throw new Exception("Test Error Message"); 29 else 30 return "No Exception Thrown"; 31 } 32 33 export string[] testStringRanges(dstring[] arr) { 34 import std.conv : to; 35 string[] temp; 36 foreach(s; arr) { 37 temp ~= to!string(s); 38 } 39 return temp; 40 } 41 42 export SysTime[] systimeArrayTest(SysTime[] array) { 43 return array.dup; 44 } 45 46 export Duration durationTest(Duration value) { 47 return value; 48 } 49 50 export DateTime dateTimeTest(DateTime value) { 51 return value; 52 } 53 54 struct s1 { 55 public float value; 56 public s2 nestedStruct; 57 58 public float getValue() { 59 return value; 60 } 61 62 public void setNestedStruct(s2 nested) { 63 nestedStruct = nested; 64 } 65 66 public string parameterlessMethod() { 67 return "Parameterless Method"; 68 } 69 } 70 71 struct s2 { 72 public int value; 73 public string str; 74 } 75 76 class c1 { 77 public int intValue; 78 protected string stringValue; 79 public @property string StringValueGetter() { 80 return stringValue; 81 } 82 83 public this(string s, int i) { 84 intValue = i; 85 stringValue = s; 86 } 87 88 public string parameterlessMethod() { 89 return "Parameterless Method"; 90 } 91 92 //Member variable test cases 93 public bool boolMember; 94 public byte byteMember; 95 public ubyte ubyteMember; 96 public short shortMember; 97 public ushort ushortMember; 98 public int intMember; 99 public uint uintMember; 100 public long longMember; 101 public ulong ulongMember; 102 public float floatMember; 103 public double doubleMember; 104 public string stringMember; 105 public wstring wstringMember; 106 public dstring dstringMember; 107 public s1 valueMember; 108 public c1 refMember; 109 public c1[] refArray; 110 public s1[] structArray; 111 public Duration durationMember; 112 public Date dateMember; 113 public DateTime dateTimeMember; 114 public SysTime sysTimeMember; 115 public TimeOfDay timeOfDayMember; 116 public Duration[] durationArray; 117 public Date[] dateArray; 118 public DateTime[] dateTimeArray; 119 public SysTime[] sysTimeArray; 120 public TimeOfDay[] timeOfDayArray; 121 122 //Property test cases 123 private s2 _structProperty; 124 public @property s2 structProperty() { 125 return _structProperty; 126 } 127 public @property s2 structProperty(s2 value) { 128 return _structProperty = value; 129 } 130 131 private c1 _refProperty; 132 public @property c1 refProperty() { 133 return _refProperty; 134 } 135 public @property c1 refProperty(c1 value) { 136 return _refProperty = value; 137 } 138 139 private ulong _valueProperty = 1001; 140 public @property ulong valueProperty() { 141 return _valueProperty; 142 } 143 public @property ulong valueProperty(ulong value) { 144 return _valueProperty = value; 145 } 146 147 private ulong[] _valueSliceProperty; 148 public @property ulong[] valueSliceProperty() { 149 return valueSliceProperty; 150 } 151 public @property ulong[] valueSliceProperty(ulong[] value) { 152 return valueSliceProperty = value; 153 } 154 155 private string[] _stringSliceProperty; 156 public @property string[] stringSliceProperty() { 157 return _stringSliceProperty; 158 } 159 public @property string[] stringSliceProperty(string[] value) { 160 return _stringSliceProperty = value; 161 } 162 163 private wstring[] _wstringSliceProperty; 164 public @property wstring[] wstringSliceProperty() { 165 return _wstringSliceProperty; 166 } 167 public @property wstring[] wstringSliceProperty(wstring[] value) { 168 return _wstringSliceProperty = value; 169 } 170 171 private dstring[] _dstringSliceProperty; 172 public @property dstring[] dstringSliceProperty() { 173 return _dstringSliceProperty; 174 } 175 public @property dstring[] dstringSliceProperty(dstring[] value) { 176 return _dstringSliceProperty = value; 177 } 178 179 private s1[] _structSliceProperty; 180 public @property s1[] structSliceProperty() { 181 return _structSliceProperty; 182 } 183 public @property s1[] structSliceProperty(s1[] value) { 184 return _structSliceProperty = value; 185 } 186 187 private c1[] _refSliceProperty; 188 public @property c1[] refSliceProperty() { 189 return _refSliceProperty; 190 } 191 public @property c1[] refSliceProperty(c1[] value) { 192 return _refSliceProperty = value; 193 } 194 195 private SysTime _sysTimeProperty; 196 public @property SysTime sysTimeProperty() { 197 return _sysTimeProperty; 198 } 199 public @property SysTime sysTimeProperty(SysTime value) { 200 return _sysTimeProperty = value; 201 } 202 203 private SysTime[] _sysTimeSliceProperty; 204 public @property SysTime[] sysTimeSliceProperty() { 205 return _sysTimeSliceProperty; 206 } 207 public @property SysTime[] sysTimeSliceProperty(SysTime[] value) { 208 return _sysTimeSliceProperty = value; 209 } 210 211 public string testMemberFunction(string test, s1 value){ 212 return test; 213 } 214 }