Debian Codegraph @

test/unit/expect.h

raw symbols SCIP
1 /*
2 * %injeqt copyright begin%
3 * Copyright 2014 Rafał Malinowski ([email protected])
4 * %injeqt copyright end%
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 #pragma once
22
23 #include <QtTest/QTest>
24 #include <functional>
25
26 template<typename E>
27 void expectcxx . . $ expect(d99b926da2bbc072).(const stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> &contents, stdcxx . . $ std/::functioncxx . . $ std/function#<void()> call)
28 {
29 try
30 {
31 call(cxx . . $ std/function#`operator()`(39e0826ffb540481).);
32 QFAILcxx . . $ `<external>/8602788698586413231/qtestcase.h:69:9`!("Exception not thrown");
33 }
34 catch (E &e)
35 {
36 for (auto &&content : contents)
37 if (stdcxx . . $ std/::stringcxx . . $ std/string#(e.what()).findcxx . . $ std/__cxx11/basic_string#find(7e867d215bf3e68).(content) == stdcxx . . $ std/::stringcxx . . $ std/string#::nposcxx . . $ std/__cxx11/basic_string#npos.)
38 QFAILcxx . . $ `<external>/8602788698586413231/qtestcase.h:69:9`!(qPrintablecxx . . $ `<external>/15045578679651060896/qglobal.h:831:11`!(QString{"Expected string '%1' not found in exception message '%2'"}
39 .arg(content.c_str())
40 .arg(e.what())));
41 }
42 catch (stdcxx . . $ std/::exception &e)
43 {
44 QFAILcxx . . $ QtPrivate/(qPrintablecxx . . $ `<external>/15045578679651060896/qglobal.h:831:11`!(QString{"Unexpected exception thrown: %1 %2"}
45 .arg(typeid(e).name())
46 .arg(e.what())));
47 }
48 catch (...)
49 {
50 QFAILcxx . . $ `<external>/8602788698586413231/qtestcase.h:69:9`!("Unexpected exception thrown");
51 }
52 }
53
54 template<typename E>
55 void expectcxx . . $ expect(13411efb8aeb1b14).(stdcxx . . $ std/::functioncxx . . $ std/function#<void()> call)
56 {
57 expectcxx . . $ expect(13411efb8aeb1b14).<E>({}, call);
58 }