Move test files and compile them in debug mode.
authorMilian Wolff <mail@milianw.de>
Thu, 15 May 2014 20:32:34 +0000 (22:32 +0200)
committerMilian Wolff <mail@milianw.de>
Thu, 15 May 2014 20:32:37 +0000 (22:32 +0200)
CMakeLists.txt
tests/CMakeLists.txt [new file with mode: 0644]
tests/test.c [moved from test.c with 100% similarity]
tests/test.cpp [moved from test.cpp with 79% similarity]

index 0bdb94e..a938053 100644 (file)
@@ -12,7 +12,6 @@ target_link_libraries(mallocinfo dumpmallocinfo)
 add_library(malloctrace SHARED malloctrace.cpp)
 target_link_libraries(malloctrace -ldl -lunwind)
 
-add_executable(test_c test.c)
-add_executable(test_cpp test.cpp)
-
 install(TARGETS mallocinfo RUNTIME DESTINATION bin)
+
+add_subdirectory(tests)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..12574a4
--- /dev/null
@@ -0,0 +1,4 @@
+set(CMAKE_BUILD_TYPE Debug)
+
+add_executable(test_c test.c)
+add_executable(test_cpp test.cpp)
similarity index 100%
rename from test.c
rename to tests/test.c
similarity index 79%
rename from test.cpp
rename to tests/test.cpp
index 6e57cf9..db52e6b 100644 (file)
--- a/test.cpp
@@ -13,6 +13,23 @@ struct Foo {
     int* i;
 };
 
+void asdf()
+{
+    int* i = new int;
+    printf("i in asdf: %p\n", i);
+    delete i;
+}
+
+void bar()
+{
+    asdf();
+}
+
+void laaa()
+{
+    bar();
+}
+
 static Foo foo;
 
 int main()
@@ -47,5 +64,10 @@ int main()
     printf("posix_memalign: %p\n", buf);
     free(buf);
 
+    for (int i = 0; i < 10; ++i) {
+        laaa();
+    }
+    laaa();
+
     return 0;
 }