[llvm-bugs] [Bug 38387] New: Weak Unit Test: HashingTest.HashValueBasicTest

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 31 09:12:39 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38387

            Bug ID: 38387
           Summary: Weak Unit Test: HashingTest.HashValueBasicTest
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: 1101.debian at gmail.com
                CC: llvm-bugs at lists.llvm.org

Hello, 

I'm (very slowly) analyzing quality of the LLVM's test suite using mutation
testing[1].
I started with ADTTests and the very first weak test I found is the following:

    HashingTest.HashValueBasicTest: unittests/ADT/HashingTest.cpp:58

Seems like the test does not test actual implementation.

I was able to reduce original function from

    inline hash_code hash_integer_value(uint64_t value) {
      // Similar to hash_4to8_bytes but using a seed instead of length.
      const uint64_t seed = get_execution_seed();
      const char *s = reinterpret_cast<const char *>(&value);
      const uint64_t a = fetch32(s);
      return hash_16_bytes(seed + (a << 3), fetch32(s + 4));
    }

to

    inline hash_code hash_integer_value(uint64_t value) {
      // Similar to hash_4to8_bytes but using a seed instead of length.
      const char *s = reinterpret_cast<const char *>(&value);
      return hash_16_bytes(0, fetch32(s));
    }

Code coverage in both cases is 100%, but all the tests are still passing.

I hope it helps.

[1] https://github.com/mull-project/mull

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180731/7113a0fd/attachment.html>


More information about the llvm-bugs mailing list