logd: add tests for log deduplication

Fix a subtle bug that liblog event messages have a payload of int32_t,
not uint32_t, so they should only be summed to int32_t max.

Make a bunch of test improvements as well to support these.

Test: these tests
Change-Id: I4069cc546240bfffec5b19f34ebec913799674e8
diff --git a/logd/ChattyLogBuffer.cpp b/logd/ChattyLogBuffer.cpp
index 9e08e9d..f1305a5 100644
--- a/logd/ChattyLogBuffer.cpp
+++ b/logd/ChattyLogBuffer.cpp
@@ -28,6 +28,7 @@
 #include <time.h>
 #include <unistd.h>
 
+#include <limits>
 #include <unordered_map>
 #include <utility>
 
@@ -286,7 +287,7 @@
                     lastLoggedElements[LOG_ID_EVENTS] = elem;
                     total += htole32(swab);
                     // check for overflow
-                    if (total >= UINT32_MAX) {
+                    if (total >= std::numeric_limits<int32_t>::max()) {
                         log(currentLast);
                         unlock();
                         return len;