Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/stdlib Do not blindly cast things (obviously ...



details:   https://anonhg.NetBSD.org/src/rev/7691e05c7e70
branches:  trunk
changeset: 765763:7691e05c7e70
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sun Jun 05 13:51:46 2011 +0000

description:
Do not blindly cast things (obviously makes the test fail).

diffstat:

 tests/lib/libc/stdlib/t_strtol.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (47 lines):

diff -r 2f5bb459ad48 -r 7691e05c7e70 tests/lib/libc/stdlib/t_strtol.c
--- a/tests/lib/libc/stdlib/t_strtol.c  Sun Jun 05 13:49:46 2011 +0000
+++ b/tests/lib/libc/stdlib/t_strtol.c  Sun Jun 05 13:51:46 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_strtol.c,v 1.2 2011/06/04 22:49:49 haad Exp $ */
+/*     $NetBSD: t_strtol.c,v 1.3 2011/06/05 13:51:46 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_strtol.c,v 1.2 2011/06/04 22:49:49 haad Exp $");
+__RCSID("$NetBSD: t_strtol.c,v 1.3 2011/06/05 13:51:46 jruoho Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -40,7 +40,7 @@
 
 struct test {
        const char      *str;
-       long int         res;
+       long long int    res;
        int              base;
        const char      *end;
 };
@@ -55,7 +55,7 @@
                atf_tc_fail_nonfatal("strtol(%s, &end, %d) failed "
                    "(rv = %ld)", t->str, t->base, li);
 
-       if (lli != -1 && lli != (long long int)t->res)
+       if (lli != -1 && lli != t->res)
                atf_tc_fail_nonfatal("strtoll(%s, NULL, %d) failed "
                    "(rv = %lld)", t->str, t->base, lli);
 
@@ -92,8 +92,8 @@
                { "123456789",                      342391,  8, NULL    },
                { "0123456789",                     342391,  0, NULL    },
                { "0123456789",                  123456789, 10, NULL    },
-               { "0123456789",                (uint32_t)0x123456789, 16, NULL  },
-               { "0x123456789",               (uint32_t)0x123456789,  0, NULL  },
+               { "0123456789",                0x123456789, 16, NULL    },
+               { "0x123456789",               0x123456789,  0, NULL    },
                { "0x75bcd15",                   123456789,  0, NULL    },
        };
 



Home | Main Index | Thread Index | Old Index