avutil/log: add code to test av_log()
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 3 Apr 2014 20:38:30 +0000 (22:38 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 3 Apr 2014 20:38:30 +0000 (22:38 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/Makefile
libavutil/log.c

index a90347c..d2ebebc 100644 (file)
@@ -158,6 +158,7 @@ TESTPROGS = adler32                                                     \
             lfg                                                         \
             lls1                                                        \
             lls2                                                        \
+            log                                                         \
             md5                                                         \
             murmur3                                                     \
             opt                                                         \
index 3a6ab12..843d2e9 100644 (file)
@@ -375,3 +375,26 @@ void avpriv_report_missing_feature(void *avc, const char *msg, ...)
     missing_feature_sample(0, avc, msg, argument_list);
     va_end(argument_list);
 }
+
+#ifdef TEST
+// LCOV_EXCL_START
+#include <string.h>
+
+int main(int argc, char **argv)
+{
+    int i;
+    av_log_set_level(AV_LOG_DEBUG);
+    for (use_color=0; use_color<=256; use_color = 255*use_color+1) {
+        av_log(NULL, AV_LOG_FATAL, "use_color: %d\n", use_color);
+        for (i = AV_LOG_DEBUG; i>=AV_LOG_QUIET; i-=8) {
+            av_log(NULL, i, " %d", i);
+            av_log(NULL, AV_LOG_INFO, "e ");
+            av_log(NULL, i + 256*123, "C%d", i);
+            av_log(NULL, AV_LOG_INFO, "e");
+        }
+        av_log(NULL, AV_LOG_PANIC, "\n");
+    }
+    return 0;
+}
+// LCOV_EXCL_STOP
+#endif