Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Persch
poppler
Commits
853623c2
Commit
853623c2
authored
Nov 28, 2018
by
Greg Knight
Browse files
use qt5 _data tests per Adam Reichold's recommendation
parent
96a0c301
Changes
1
Hide whitespace changes
Inline
Side-by-side
qt5/tests/check_goostring.cpp
View file @
853623c2
...
...
@@ -14,6 +14,7 @@ private slots:
void
testInsert
();
void
testFormat
();
void
testFromNullptr
();
void
testFromInt_data
();
void
testFromInt
();
};
...
...
@@ -162,23 +163,24 @@ void TestGooString::testFromNullptr()
}
}
void
TestGooString
::
testFromInt_data
()
{
QTest
::
addColumn
<
int
>
(
"inty"
);
QTest
::
addColumn
<
QByteArray
>
(
"stringy"
);
QTest
::
newRow
(
"Natural"
)
<<
12345
<<
QByteArray
(
"12345"
);
QTest
::
newRow
(
"Negative"
)
<<
-
1
<<
QByteArray
(
"-1"
);
QTest
::
newRow
(
"Zero"
)
<<
0
<<
QByteArray
(
"0"
);
QTest
::
newRow
(
"INT_MAX"
)
<<
0x7fffffff
<<
QByteArray
(
"2147483647"
);
QTest
::
newRow
(
"-INT_MAX-1"
)
<<
(
-
0x7fffffff
-
1
)
<<
QByteArray
(
"-2147483648"
);
}
void
TestGooString
::
testFromInt
()
{
struct
_testcase
{
int
inty
;
const
char
*
str
;
}
cases
[]
=
{
{
12345
,
"12345"
},
{
-
1
,
"-1"
},
{
0
,
"0"
},
{
0x7fffffff
,
"2147483647"
},
{
-
0x7fffffff
-
1
,
"-2147483648"
},
};
for
(
size_t
k
=
0
;
k
<
sizeof
(
cases
)
/
sizeof
(
cases
[
0
]);
++
k
)
{
QScopedPointer
<
GooString
>
str
(
GooString
::
fromInt
(
cases
[
k
].
inty
));
QCOMPARE
(
str
->
c_str
(),
cases
[
k
].
str
);
}
QFETCH
(
int
,
inty
);
QFETCH
(
QByteArray
,
stringy
);
QScopedPointer
<
GooString
>
str
(
GooString
::
fromInt
(
inty
));
QCOMPARE
(
str
->
c_str
(),
stringy
.
constData
());
}
QTEST_GUILESS_MAIN
(
TestGooString
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment