On Tue, Mar 15, 2011 at 11:36:26AM +1000, Peter Hutterer wrote:
> On Mon, Mar 14, 2011 at 04:10:59PM -0700, Jason Gerecke wrote:
> > Some basic tests to ensure booleans and non-booleans act like we
> > want them to.
> > 
> > Signed-off-by: Jason Gerecke <killert...@gmail.com>
> > ---
> >  Changes from v2:
> > 
> >  * Use &val instead of allocating memory
> > 
> >  tools/xsetwacom.c |   38 ++++++++++++++++++++++++++++++++++++++
> >  1 files changed, 38 insertions(+), 0 deletions(-)
> > 
> > diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
> > index c9db2e7..8cc7292 100644
> > --- a/tools/xsetwacom.c
> > +++ b/tools/xsetwacom.c
> > @@ -2227,6 +2227,43 @@ static void test_parameter_number(void)
> >     g_assert(ArrayLength(deprecated_parameters) == 16);
> >  }
> >  
> > +static void test_convert_value_from_user(void)
> > +{
> > +   param_t test_nonbool =
> > +   {
> > +           .name = "Test",
> > +           .desc = "NOT A REAL PARAMETER",
> > +           .prop_flags = 0,
> > +   };
> > +
> > +   param_t test_bool =
> > +   {
> > +           .name = "Test",
> > +           .desc = "NOT A REAL PARAMETER",
> > +           .prop_flags = PROP_FLAG_BOOLEAN,
> > +   };
> > +
> > +   int val;
> > +
> > +   g_assert(convert_value_from_user(&test_nonbool, "1", &val) == True);
> > +   g_assert(convert_value_from_user(&test_nonbool, "-8", &val) == True);
> > +   g_assert(convert_value_from_user(&test_nonbool, "+314", &val) == True);
> > +   g_assert(convert_value_from_user(&test_nonbool, "36893488147419103232", 
> > &val) == False); //2^65 > MAX_INT
> > +   g_assert(convert_value_from_user(&test_nonbool, "123abc", &val) == 
> > False);
> > +   g_assert(convert_value_from_user(&test_nonbool, "123 abc", &val) == 
> > False);
> > +
> > +   g_assert(convert_value_from_user(&test_bool, "true", &val) == True);
> > +   g_assert(convert_value_from_user(&test_bool, "On", &val) == True);
> > +   g_assert(convert_value_from_user(&test_bool, "oFf", &val) == True);
> > +   g_assert(convert_value_from_user(&test_bool, "FALSE", &val) == True);
> > +   g_assert(convert_value_from_user(&test_bool, "0", &val) == False);
> > +   g_assert(convert_value_from_user(&test_bool, "1", &val) == False);
> > +   g_assert(convert_value_from_user(&test_bool, " on", &val) == False);
> > +   g_assert(convert_value_from_user(&test_bool, "off ", &val) == False);
> > +
> > +   free(retval);
> > +}
> 
> 
> hmm, did you compile this?

ok, this was the only issue and the tests pass. Merged all 5 patches,
thanks.

Cheers,
  Peter

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to