From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfURz-0003Rj-KO for qemu-devel@nongnu.org; Fri, 25 Sep 2015 10:58:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfURy-0004SQ-NF for qemu-devel@nongnu.org; Fri, 25 Sep 2015 10:58:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfURy-0004SG-Hu for qemu-devel@nongnu.org; Fri, 25 Sep 2015 10:58:14 -0400 References: <1443184788-18859-1-git-send-email-afaerber@suse.de> <1443184788-18859-5-git-send-email-afaerber@suse.de> From: Eric Blake Message-ID: <56056104.9030304@redhat.com> Date: Fri, 25 Sep 2015 08:58:12 -0600 MIME-Version: 1.0 In-Reply-To: <1443184788-18859-5-git-send-email-afaerber@suse.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qS11OvUxuFp8RMGG3wWGHlbGc5q4hBg2H" Subject: Re: [Qemu-devel] [PATCH 4/7] tests: Add QOM property unit tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=c3=a4rber?= , qemu-devel@nongnu.org Cc: Paolo Bonzini , Bruce Rogers , Lin Ma , Markus Armbruster , Michael Roth This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --qS11OvUxuFp8RMGG3wWGHlbGc5q4hBg2H Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/25/2015 06:39 AM, Andreas F=C3=A4rber wrote: > Add a test for parsing and setting a uint64 property. >=20 > Signed-off-by: Andreas F=C3=A4rber > --- > MAINTAINERS | 1 + > tests/Makefile | 3 ++ > tests/check-qom-props.c | 120 ++++++++++++++++++++++++++++++++++++++++= ++++++++ > 3 files changed, 124 insertions(+) > create mode 100644 tests/check-qom-props.c >=20 > +static void test_dummy_uint64(void) > +{ > + Error *err =3D NULL; > + char *str; > + DummyObject *dobj =3D DUMMY_OBJECT(object_new(TYPE_DUMMY)); > + > + g_assert(dobj->u64val =3D=3D 0); > + > + str =3D g_strdup_printf("%" PRIu64, UINT64_MAX); > + object_property_parse(OBJECT(dobj), str, "u64val", &err); > + g_free(str); > + g_assert(!err); Use &error_abort, then you don't need the g_assert(!err). > + g_assert_cmpint(dobj->u64val, =3D=3D, UINT64_MAX); > + > + dobj->u64val =3D 0; > + str =3D g_strdup_printf("0x%" PRIx64, UINT64_MAX); > + object_property_parse(OBJECT(dobj), str, "u64val", &err); > + g_free(str); > + g_assert(!err); > + g_assert_cmpint(dobj->u64val, =3D=3D, UINT64_MAX); > + > + object_unref(OBJECT(dobj)); As with other patches in this series, intentionally testing the behavior of -1, and of (ULLONG_MAX+1), would be good. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --qS11OvUxuFp8RMGG3wWGHlbGc5q4hBg2H Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWBWEEAAoJEKeha0olJ0NqGZcH/0bkpl/AKAKZ31n1fR5fn1uu SYMppY3otPP3/GH/ivRkvftBF5uUCfB/TaPsYW/Y6obe8OcWHD5ymC+ueMnTavFO IPpkOVOsCdwyIByuxYysyHjS+hwjoEcKpjcMXd10VLfKiDmrowR+hFiLIoftQyV/ v5Zi4OD4HIFM5IuLeh6rLc3YM3WA/dhCT8e0LbVZl1UvqrA7G8siabfP2Q/3ClQn 11q+WjEntIbwaUt9iKTt454SJXzDenyNxOgT9gOdA3dPRC1uvp+X/TU2ZaeifczI f7voPOdpu39OH4nL4Fowfi/tk5ly0ldWWim0FZyHT/PaVhs7inPJc4hjuLX/UbM= =2tSH -----END PGP SIGNATURE----- --qS11OvUxuFp8RMGG3wWGHlbGc5q4hBg2H--