diff options
Diffstat (limited to 'client/test/util.h')
-rw-r--r-- | client/test/util.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/client/test/util.h b/client/test/util.h index abf7df5..03b3e8a 100644 --- a/client/test/util.h +++ b/client/test/util.h @@ -31,3 +31,16 @@ QDomElement getWidgetElement(QString type = "", QCOMPARE(wdg.value(), QString("")); \ wdg.setValue("hello", "source"); \ QCOMPARE(wdg.value(), QString("hello")); + +#define TEST_MEMLEAK(C) { \ + FILE *memlk_fp = fopen("/proc/self/statm", "r"); \ + int memlk_before; \ + int memlk_after; \ + fscanf(memlk_fp, "%d", &memlk_before); \ + { C; } \ + rewind(memlk_fp); \ + fscanf(memlk_fp, "%d", &memlk_after); \ + fclose(memlk_fp); \ + QCOMPARE(memlk_before, memlk_after); \ + } + |