Commit 8c559757 authored by EXT Arnaud Clère's avatar EXT Arnaud Clère
Browse files

Fixed all QDataStream benches

parent 3a1fae1e
...@@ -165,27 +165,6 @@ int main() ...@@ -165,27 +165,6 @@ int main()
GROUP("<atoms") GROUP("<atoms")
{ {
START {
b.seek(0); b.buffer().clear();
QDataStream(&b)
<< 1.333333333333f
<< PI
<< text
<< false
;
}
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
START {
b.seek(0); b.buffer().clear();
QDataStream d(&b);
DataStreamWriter(&d).sequence()
.bind(1.333333333333f)
.bind(PI)
.bind(text)
.bind(false)
;
}
STOP("DataStream",QString::fromUtf8(b.buffer().toHex()));
START { START {
s.clear(); s.clear();
QDebug(&s) QDebug(&s)
...@@ -240,24 +219,31 @@ int main() ...@@ -240,24 +219,31 @@ int main()
CborWriter(&b).bind(writables); // TODO Fix false > 0 CborWriter(&b).bind(writables); // TODO Fix false > 0
} }
STOP("Writables>Cbor",QString::fromUtf8(b.buffer().toHex())); STOP("Writables>Cbor",QString::fromUtf8(b.buffer().toHex()));
}
GROUP_STOP;
GROUP("<doubles")
{
START { START {
b.seek(0); b.buffer().clear(); b.seek(0); b.buffer().clear();
QDataStream data(&b); QDataStream d(&b);
for (int i=0; i < 16; i++) { DataStreamWriter(&d).sequence()
data << transform[i]; .bind(1.333333333333f)
}; .bind(PI)
.bind(text)
.bind(false)
;
} }
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex())); STOP("DataStream",QString::fromUtf8(b.buffer().toHex()));
START { START {
b.seek(0); b.buffer().clear(); b.seek(0); b.buffer().clear();
QDataStream d(&b); QDataStream(&b)
DataStreamWriter(&d).bind(transform); << 1.333333333333f
<< PI
<< text
<< false
;
} }
STOP("DataStream",QString::fromUtf8(b.buffer().toHex())); STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
}
GROUP_STOP;
GROUP("<doubles")
{
START { START {
s.clear(); s.clear();
QDebug data(&s); QDebug data(&s);
...@@ -292,27 +278,25 @@ int main() ...@@ -292,27 +278,25 @@ int main()
CborWriter(&b).bind(writable); CborWriter(&b).bind(writable);
} }
STOP("Writable>Cbor",QString::fromUtf8(b.buffer().toHex())); STOP("Writable>Cbor",QString::fromUtf8(b.buffer().toHex()));
}
GROUP_STOP
GROUP("<Person")
{
START { START {
b.seek(0); b.buffer().clear(); b.seek(0); b.buffer().clear();
QDataStream(&b) QDataStream d(&b);
<< person.firstName.constData() DataStreamWriter(&d).bind(transform);
<< person. lastName.constData()
<< person. height
<< person. age
<< person. phones
;
} }
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex())); STOP("DataStream",QString::fromUtf8(b.buffer().toHex()));
START { START {
b.seek(0); b.buffer().clear(); b.seek(0); b.buffer().clear();
QDataStream d(&b); QDataStream data(&b);
DataStreamWriter(&d).bind(person); data << transform.size();
for (int i=0; i < 16; i++) {
data << transform[i];
};
} }
STOP("DataStream",QString::fromUtf8(b.buffer().toHex())); STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
}
GROUP_STOP
GROUP("<Person")
{
START { START {
s.clear(); s.clear();
QDebug(&s) << '[' QDebug(&s) << '['
...@@ -349,6 +333,23 @@ int main() ...@@ -349,6 +333,23 @@ int main()
CborWriter(&b).bind(writable); CborWriter(&b).bind(writable);
} }
STOP("Writable>Cbor",QString::fromUtf8(b.buffer().toHex())); STOP("Writable>Cbor",QString::fromUtf8(b.buffer().toHex()));
START {
b.seek(0); b.buffer().clear();
QDataStream d(&b);
DataStreamWriter(&d).bind(person);
}
STOP("DataStream",QString::fromUtf8(b.buffer().toHex()));
START {
b.seek(0); b.buffer().clear();
QDataStream d(&b);
d << person.firstName;
d << person. lastName;
d << person. height;
d << person. age;
d << person. phones;
;
}
STOP("QDataStream",QString::fromUtf8(b.buffer().toHex()));
} }
GROUP_STOP GROUP_STOP
GROUP("Read+Write") GROUP("Read+Write")
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment