Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F111920
qt-json-test.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
846 B
Referenced Files
None
Subscribers
None
qt-json-test.cpp
View Options
/*
* This file is part of kazv.
* SPDX-FileCopyrightText: 2024 tusooa <tusooa@kazv.moe>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#include
<libkazv-config.hpp>
#include
<immer/config.hpp>
#include
<QtTest>
#include
"qt-json.hpp"
class
QtJsonTest
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
testNumericConv
();
};
static
auto
j
=
nlohmann
::
json
::
parse
(
R
"
(
{
"foo": 1
}
)
"
);
static
auto
jFloat
=
nlohmann
::
json
::
parse
(
R
"
(
{
"foo": 1.0
}
)
"
);
static
auto
jFloat2
=
nlohmann
::
json
::
parse
(
R
"
(
{
"foo": 1.1
}
)
"
);
void
QtJsonTest::testNumericConv
()
{
QJsonObject
qj
=
j
;
nlohmann
::
json
j2
=
qj
;
QVERIFY
(
j2
==
j
);
qj
=
jFloat
;
j2
=
qj
;
QVERIFY
(
j2
==
j
);
QVERIFY
(
j2
==
jFloat
);
qj
=
jFloat2
;
j2
=
qj
;
QVERIFY
(
j2
==
jFloat2
);
}
QTEST_MAIN
(
QtJsonTest
)
#include
"qt-json-test.moc"
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Fri, Nov 22, 3:10 AM (6 h, 19 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38657
Default Alt Text
qt-json-test.cpp (846 B)
Attached To
Mode
rK kazv
Attached
Detach File
Event Timeline
Log In to Comment