Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc/gen This does not fail anymore. Explain why t...



details:   https://anonhg.NetBSD.org/src/rev/731c3718185e
branches:  trunk
changeset: 778138:731c3718185e
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Mar 17 20:06:46 2012 +0000

description:
This does not fail anymore. Explain why the test was modified.

diffstat:

 tests/lib/libc/gen/t_humanize_number.c |  22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diffs (66 lines):

diff -r 56c17a5df957 -r 731c3718185e tests/lib/libc/gen/t_humanize_number.c
--- a/tests/lib/libc/gen/t_humanize_number.c    Sat Mar 17 20:01:14 2012 +0000
+++ b/tests/lib/libc/gen/t_humanize_number.c    Sat Mar 17 20:06:46 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_humanize_number.c,v 1.6 2012/03/15 01:44:07 joerg Exp $      */
+/*     $NetBSD: t_humanize_number.c,v 1.7 2012/03/17 20:06:46 christos Exp $   */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -247,7 +247,7 @@
 ATF_TC_HEAD(humanize_number_big, tc)
 {
 
-       atf_tc_set_md_var(tc, "descr", "Test humanize big numbers");
+       atf_tc_set_md_var(tc, "descr", "Test humanize big numbers (PR/44097)");
 }
 
 ATF_TC_BODY(humanize_number_big, tc)
@@ -255,26 +255,22 @@
        char buf[1024];
        int rv;
 
-       atf_tc_expect_fail("PR lib/44097");
-
        /*
         * Seems to work.
         */
        (void)memset(buf, 0, sizeof(buf));
 
-       rv = humanize_number(buf, 10, 10000, "",
-           HN_AUTOSCALE, HN_NOSPACE);
+       rv = humanize_number(buf, 10, 10000, "", HN_AUTOSCALE, HN_NOSPACE);
 
        ATF_REQUIRE(rv != -1);
-       ATF_REQUIRE(strcmp(buf, "10000") == 0);
+       ATF_CHECK_STREQ(buf, "10000");
 
        /*
         * A bogus value with large number.
         */
        (void)memset(buf, 0, sizeof(buf));
 
-       rv = humanize_number(buf, 10, INT64_MAX, "",
-           HN_AUTOSCALE, HN_NOSPACE);
+       rv = humanize_number(buf, 10, INT64_MAX, "", HN_AUTOSCALE, HN_NOSPACE);
 
        ATF_REQUIRE(rv != -1);
        ATF_REQUIRE(strcmp(buf, "0") != 0);
@@ -293,12 +289,14 @@
        /*
         * Tight buffer.
         *
-        * The man page says that len must be at least 4, but...
+        * The man page says that len must be at least 4.
+        * 3 works, but anything less that will not. This
+        * is because baselen starts with 2 for positive
+        * numbers.
         */
        (void)memset(buf, 0, sizeof(buf));
 
-       rv = humanize_number(buf, 1, 1, "",
-           HN_AUTOSCALE, HN_NOSPACE);
+       rv = humanize_number(buf, 3, 1, "", HN_AUTOSCALE, HN_NOSPACE);
 
        ATF_REQUIRE(rv != -1);
 }



Home | Main Index | Thread Index | Old Index