Re: [RFC virt-viewer 09/12] util: Add some runtime testing of virt_viewer_compare_buildid()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

On Wed, Jun 03, 2015 at 09:51:12AM -0500, Jonathon Jongsma wrote:
> On Tue, 2015-06-02 at 16:29 +0200, Christophe Fergeau wrote:
> > ---
> >  src/virt-viewer-file.c | 28 ++++++++++++++++++++++++++++
> >  1 file changed, 28 insertions(+)
> > 
> > diff --git a/src/virt-viewer-file.c b/src/virt-viewer-file.c
> > index 240a111..6865e04 100644
> > --- a/src/virt-viewer-file.c
> > +++ b/src/virt-viewer-file.c
> > @@ -818,6 +818,34 @@ virt_viewer_file_fill_app(VirtViewerFile* self, VirtViewerApp *app, GError **err
> >      g_return_val_if_fail(VIRT_VIEWER_IS_FILE(self), FALSE);
> >      g_return_val_if_fail(VIRT_VIEWER_IS_APP(app), FALSE);
> >  
> > +    g_assert(virt_viewer_compare_buildid("1-1", "1-1") == 0);
> > +    g_assert(virt_viewer_compare_buildid("1-1", "1-1.1") == -1);
> > +    g_assert(virt_viewer_compare_buildid("1-1", "1-2") == -1);
> > +    g_assert(virt_viewer_compare_buildid("1-3", "1-2") == 1);
> > +    g_assert(virt_viewer_compare_buildid("2-3", "1-2") == 1);
> > +    g_assert(virt_viewer_compare_buildid("2-3", "3-2") == -1);
> > +    g_assert(virt_viewer_compare_buildid("2-3", "3-4") == -1);
> > +    g_assert(virt_viewer_compare_buildid("4-3", "3-4") == 1);
> > +
> > +    g_assert(virt_viewer_compare_buildid("4-", "3-4") == 1);
> > +    g_assert(virt_viewer_compare_buildid("4-3", "3-") == 1);
> > +    g_assert(virt_viewer_compare_buildid("-3", "3-4") == -1);
> > +    g_assert(virt_viewer_compare_buildid("4-3", "-4") == 1);
> > +    g_assert(virt_viewer_compare_buildid("-3", "-4") == -1);
> > +    g_assert(virt_viewer_compare_buildid("4", "3-4") == 1);
> > +    g_assert(virt_viewer_compare_buildid("4-3", "3") == 1);
> > +    g_assert(virt_viewer_compare_buildid("3", "3-4") == -1);
> > +    g_assert(virt_viewer_compare_buildid("4-3", "4") == 1);
> > +    g_assert(virt_viewer_compare_buildid("-3", "-4") == -1);
> > +
> > +#if 0
> > +    /* These trigger runtime warnings */
> > +    g_assert(virt_viewer_compare_buildid("-3", "-") == 1);
> > +    g_assert(virt_viewer_compare_buildid("", "-") == 0);
> > +    g_assert(virt_viewer_compare_buildid("", "") == 0);
> > +    g_assert(virt_viewer_compare_buildid("", NULL) == 0);
> > +    g_assert(virt_viewer_compare_buildid(NULL, NULL) == 0);
> > +#endif
> >      if (!virt_viewer_file_check_min_version(self, error)) {
> >          return FALSE;
> >      }
> 
> 
> I don't like adding these tests to the actual code. Why don't you think
> the previous test case you added was sufficient?

I forgot to drop that patch after adding the test case ;)

Thanks!

Christophe

Attachment: pgpHR9D3PAKyH.pgp
Description: PGP signature

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list

[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux