diff test/cedet/tests/testsppcomplete.c @ 104494:e480034314ce

Add Semantic unit tests.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 20 Sep 2009 04:00:13 +0000
parents
children 7f4c7f5c0eba
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/cedet/tests/testsppcomplete.c	Sun Sep 20 04:00:13 2009 +0000
@@ -0,0 +1,29 @@
+/* Example provided by Hannes Janetzek */
+
+struct Test { int test; };
+
+#define BLA(_type) \
+  _type *bla = (_type*) malloc(sizeof(_type));
+
+#define BLUB(_type)				\
+  (_type*)malloc(sizeof(_type));
+
+#define FOO(_type)				\
+  _type *foo = BLUB(_type);
+
+#define BAR(_type)				\
+  _type *bar = (*_type)BLUB(_type);
+
+int main(int argc, char *argv[]) {
+  BLA(Test);
+  bla->// -1-
+    ; // #1# ( "test" )
+
+  FOO(Test);
+  foo->// -2-
+    ; // #2# ( "test" )
+
+  BAR(Test);
+  bar->// -3-
+    ; // #3# ( "test" )
+}