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