On 01/02/2014 04:10 PM, Wenchao Xia wrote: > These cases will verify whether the expected qdict is built. > > Signed-off-by: Wenchao Xia > --- > tests/Makefile | 14 ++- > tests/qapi-schema/qapi-schema-test.json | 12 ++ > tests/qapi-schema/qapi-schema-test.out | 10 +- > tests/test-qmp-event.c | 254 +++++++++++++++++++++++++++++++ > 4 files changed, 285 insertions(+), 5 deletions(-) > create mode 100644 tests/test-qmp-event.c > > + > +/* This function is hooked as final emit funtion, which can verify the > + correctness. */ > +static void event_test_emit(QAPIEvent ev, QDict *d, Error **errp) s/funtion/function/ > +{ > + QObject *obj; > + QDict *t; > + > + /* Verify that we have timestamp, then remove it to compare other field */ > + obj = qdict_get(d, "timestamp"); > + g_assert(obj); > + t = qobject_to_qdict(obj); > + g_assert(t); > + obj = qdict_get(t, "seconds"); > + g_assert(obj && qobject_type(obj) == QTYPE_QINT); > + obj = qdict_get(t, "microseconds"); > + g_assert(obj && qobject_type(obj) == QTYPE_QINT); > + > + qdict_del(d, "timestamp"); Should you also check that no other fields besides seconds and microseconds were in the timestamp dictionary? With the typo fixed, Reviewed-by: Eric Blake -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org