Skip to content

Commit

Permalink
add whitespace test
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvid Picciani committed Mar 22, 2010
1 parent 668261d commit e444193
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/unit/core/json/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,25 @@ private slots:
QCOMPARE(QxtJSON::parse("5123").toInt(),5123);
QCOMPARE(QxtJSON::parse("1.5").toDouble(),1.5);
}

void parseWhitespace(){
QCOMPARE(QxtJSON::parse("\r\n 51235656 \r\n").toInt(),51235656);
QCOMPARE(QxtJSON::parse("\r\n [ 51235656 ] ").toList(),QVariantList()<<51235656);

QVariantMap e;
e["bla"]="fish";
e["foo"]=5;
e["boo"]=false;
QCOMPARE(QxtJSON::parse(" { \"bla\": \"fish\" , \"boo\":false ,\n\"foo\": 5 }\n" ),QVariant(e));
}

void same(){
QVariantList e;
e<<"fish"<<true<<QVariant()<<"bla"<<false<<6.5;
QCOMPARE(QxtJSON::parse(QxtJSON::stringify(e)),QVariant(e));
}


void regressXenakios(){
QVariant e=QxtJSON::parse("{\"apina\":\"ripulia!\",\"doctype\":\"QtCDP WorkSpace\",\"processinghistory\":[{\"infilename\":\"H:/Samples from net/Berklee44v8/Berklee44v8/aluminum2.wav\",\"itemname\":\"aluminum2.wav\",\"itemtag\":\"inputfile\",\"tse\":5.62246,\"tss\":5.08163},{\"infilename\":\"H:/Samples from net/Berklee44v8/Berklee44v8/aluminum3.wav\",\"itemname\":\"aluminum3.wav\",\"itemtag\":\"inputfile\"},{\"infilename\":\"H:/Samples from net/Berklee44v8/Berklee44v8/asprin_crinkle_1.wav\",\"itemname\":\"asprin_crinkle_1.wav\",\"itemtag\":\"inputfile\",\"tse\":0.593006,\"tss\":0.255667},{\"infilename\":\"H:/Samples from net/Berklee44v8/Berklee44v8/asprin_crinkle_2.wav\",\"itemname\":\"asprin_crinkle_2.wav\",\"itemtag\":\"inputfile\",\"tse\":1.66739,\"tss\":1.53128}]}");
QVERIFY(!e.isNull());
Expand Down

0 comments on commit e444193

Please sign in to comment.