Lines Matching refs:Either
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * \brief Template class that is either type of Left or Right.
90 const Either<int, float> either (intValue);
92 TCU_CHECK(either.isFirst());
93 TCU_CHECK(!either.isSecond());
95 TCU_CHECK(either.is<int>());
96 TCU_CHECK(!either.is<float>());
98 TCU_CHECK(either.getFirst() == intValue);
99 TCU_CHECK(either.get<int>() == intValue);
105 const Either<int, float> either (floatValue);
107 TCU_CHECK(!either.isFirst());
108 TCU_CHECK(either.isSecond());
110 TCU_CHECK(!either.is<int>());
111 TCU_CHECK(either.is<float>());
113 TCU_CHECK(either.getSecond() == floatValue);
114 TCU_CHECK(either.get<float>() == floatValue);
121 Either<int, float> either (floatValue);
123 either = intValue;
125 TCU_CHECK(either.isFirst());
126 TCU_CHECK(!either.isSecond());
128 TCU_CHECK(either.is<int>());
129 TCU_CHECK(!either.is<float>());
131 TCU_CHECK(either.getFirst() == intValue);
132 TCU_CHECK(either.get<int>() == intValue);
139 Either<int, float> either (intValue);
141 either = floatValue;
143 TCU_CHECK(!either.isFirst());
144 TCU_CHECK(either.isSecond());
146 TCU_CHECK(!either.is<int>());
147 TCU_CHECK(either.is<float>());
149 TCU_CHECK(either.getSecond() == floatValue);
150 TCU_CHECK(either.get<float>() == floatValue);
153 // Assign first either value
157 Either<int, float> either (floatValue);
158 const Either<int, float> otherEither (intValue);
160 either = otherEither;
162 TCU_CHECK(either.isFirst());
163 TCU_CHECK(!either.isSecond());
165 TCU_CHECK(either.is<int>());
166 TCU_CHECK(!either.is<float>());
168 TCU_CHECK(either.getFirst() == intValue);
169 TCU_CHECK(either.get<int>() == intValue);
172 // Assign second either value
176 Either<int, float> either (intValue);
177 const Either<int, float> otherEither (floatValue);
179 either = otherEither;
181 TCU_CHECK(!either.isFirst());
182 TCU_CHECK(either.isSecond());
184 TCU_CHECK(!either.is<int>());
185 TCU_CHECK(either.is<float>());
187 TCU_CHECK(either.getSecond() == floatValue);
188 TCU_CHECK(either.get<float>() == floatValue);
194 const Either<TestClassWithConstructor, int> either (testObject);
196 TCU_CHECK(either.isFirst());
197 TCU_CHECK(!either.isSecond());
199 TCU_CHECK(either.is<TestClassWithConstructor>());
200 TCU_CHECK(!either.is<int>());
202 TCU_CHECK(either.getFirst().getValue() == testObject.getValue());
203 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());
209 const Either<int, TestClassWithConstructor> either (testObject);
211 TCU_CHECK(!either.isFirst());
212 TCU_CHECK(either.isSecond());
214 TCU_CHECK(either.is<TestClassWithConstructor>());
215 TCU_CHECK(!either.is<int>());
217 TCU_CHECK(either.getSecond().getValue() == testObject.getValue());
218 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());
225 Either<TestClassWithConstructor, int> either (intValue);
227 either = testObject;
229 TCU_CHECK(either.isFirst());
230 TCU_CHECK(!either.isSecond());
232 TCU_CHECK(either.is<TestClassWithConstructor>());
233 TCU_CHECK(!either.is<int>());
235 TCU_CHECK(either.getFirst().getValue() == testObject.getValue());
236 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());
243 Either<int, TestClassWithConstructor> either (intValue);
245 either = testObject;
247 TCU_CHECK(!either.isFirst());
248 TCU_CHECK(either.isSecond());
250 TCU_CHECK(either.is<TestClassWithConstructor>());
251 TCU_CHECK(!either.is<int>());
253 TCU_CHECK(either.getSecond().getValue() == testObject.getValue());
254 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());
257 // Assign first either with constructor
261 Either<TestClassWithConstructor, int> either (intValue);
262 const Either<TestClassWithConstructor, int> otherEither (testObject);
264 either = otherEither;
266 TCU_CHECK(either.isFirst());
267 TCU_CHECK(!either.isSecond());
269 TCU_CHECK(either.is<TestClassWithConstructor>());
270 TCU_CHECK(!either.is<int>());
272 TCU_CHECK(either.getFirst().getValue() == testObject.getValue());
273 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());
276 // Assign second either with constructor
280 Either<int, TestClassWithConstructor> either (intValue);
281 const Either<int, TestClassWithConstructor> otherEither (testObject);
283 either = otherEither;
285 TCU_CHECK(!either.isFirst());
286 TCU_CHECK(either.isSecond());
288 TCU_CHECK(either.is<TestClassWithConstructor>());
289 TCU_CHECK(!either.is<int>());
291 TCU_CHECK(either.getSecond().getValue() == testObject.getValue());
292 TCU_CHECK(either.get<TestClassWithConstructor>().getValue() == testObject.getValue());