1 void TestAliSimpleValue() {
3 gSystem->Load("libSHUTTLE");
6 AliSimpleValue a(AliSimpleValue::kBool);
7 Assert(a.GetType() == AliSimpleValue::kBool);
9 Assert(a.GetBool() == kTRUE);
12 AliSimpleValue b(kTRUE);
20 a = AliSimpleValue(kFALSE);
21 Assert(a.GetBool() == kFALSE);
25 AliSimpleValue a(AliSimpleValue::kByte);
26 Assert(a.GetType() == AliSimpleValue::kByte);
28 Assert(a.GetByte() == 30);
31 AliSimpleValue b((Char_t) 30);
32 Assert(b.GetType() == AliSimpleValue::kByte);
40 a = AliSimpleValue((Char_t) 60);
41 Assert(a.GetByte() == 60);
45 AliSimpleValue a(AliSimpleValue::kInt);
46 Assert(a.GetType() == AliSimpleValue::kInt);
48 Assert(a.GetInt() == 30);
52 Assert(b.GetType() == AliSimpleValue::kInt);
60 a = AliSimpleValue(60);
61 Assert(a.GetInt() == 60);
65 AliSimpleValue a(AliSimpleValue::kUInt);
66 Assert(a.GetType() == AliSimpleValue::kUInt);
68 Assert(a.GetUInt() == 30000);
71 AliSimpleValue b((UInt_t) 30000);
72 Assert(b.GetType() == AliSimpleValue::kUInt);
80 a = AliSimpleValue((UInt_t) 60);
81 Assert(a.GetUInt() == 60);
85 AliSimpleValue a(AliSimpleValue::kFloat);
86 Assert(a.GetType() == AliSimpleValue::kFloat);
88 Float_t delta = 1e-38;
89 Assert((a.GetFloat() <= 100.53 + delta) || (a.GetFloat() >= 100.53 - delta));
92 AliSimpleValue b((Float_t) 100.53);
93 Assert(b.GetType() == AliSimpleValue::kFloat);
101 a = AliSimpleValue((Float_t) 666.666);
102 Assert(a.GetFloat() <= 666.666 + delta || a.GetFloat() >= 666.666 - delta);
106 Bool_t buf[] = {kTRUE, kFALSE, kTRUE};
107 AliSimpleValue a(3, buf);
108 Assert(a.GetType() == AliSimpleValue::kDynBool);
109 Assert(a.GetDynamicSize() == 3);
110 Assert(a.GetDynBool(0) == kTRUE);
111 Assert(a.GetDynBool(1) == kFALSE);
112 Assert(a.GetDynBool(2) == kTRUE);
114 a.SetDynBool(1, kTRUE);
115 Assert(a.GetDynBool(1) == kTRUE);
116 a.SetDynBool(1, kFALSE);
119 AliSimpleValue b(3, buf);
127 a.SetDynBool(1, kTRUE);
133 Char_t cbuf[] = {10, 50, 60};
134 AliSimpleValue a(3, cbuf);
135 Assert(a.GetType() == AliSimpleValue::kDynByte);
136 Assert(a.GetDynamicSize() == 3);
137 Assert(a.GetDynByte(0) == 10);
138 Assert(a.GetDynByte(1) == 50);
139 Assert(a.GetDynByte(2) == 60);
141 a.SetDynByte(1, 100);
142 Assert(a.GetDynByte(1) == 100);
146 AliSimpleValue b(3, cbuf);
154 a.SetDynByte(1, 200);
160 Int_t ibuf[] = {100, 500, -60};
161 AliSimpleValue a(3, ibuf);
162 Assert(a.GetType() == AliSimpleValue::kDynInt);
163 Assert(a.GetDynamicSize() == 3);
164 Assert(a.GetDynInt(0) == 100);
165 Assert(a.GetDynInt(1) == 500);
166 Assert(a.GetDynInt(2) == -60);
169 Assert(a.GetDynInt(1) == 100);
173 AliSimpleValue b(3, ibuf);
186 UInt_t ubuf[] = {100, 504, 7060};
187 AliSimpleValue a(3, ubuf);
188 Assert(a.GetType() == AliSimpleValue::kDynUInt);
189 Assert(a.GetDynamicSize() == 3);
190 Assert(a.GetDynUInt(0) == 100);
191 Assert(a.GetDynUInt(1) == 504);
192 Assert(a.GetDynUInt(2) == 7060);
194 a.SetDynUInt(1, 100);
195 Assert(a.GetDynUInt(1) == 100);
196 a.SetDynUInt(1, 504);
199 AliSimpleValue b(3, ubuf);
207 a.SetDynUInt(1, 200);
213 Float_t fbuf[] = {100.1, 504.5, 7060};
214 AliSimpleValue a(3, fbuf);
215 Assert(a.GetType() == AliSimpleValue::kDynFloat);
216 Assert(a.GetDynamicSize() == 3);
217 Assert(a.GetDynFloat(0) <= 100.1 + delta || aGetDynFloat(0) >= 100.1 - delta);
218 Assert(a.GetDynFloat(1) <= 504.5 + delta || aGetDynFloat(1) >= 504.5 - delta);
219 Assert(a.GetDynFloat(2) <= 7060 + delta || aGetDynFloat(2) >= 7060 - delta);
221 a.SetDynFloat(1, -200.3);
222 Assert(a.GetDynFloat(1) <= -200.3 + delta || aGetDynFloat(1) >= -200.3 - delta);
223 a.SetDynFloat(1, 504.5);
227 AliSimpleValue b(3, fbuf);
235 a.SetDynFloat(1, 200);