[anjuta/cxxparser] cxxparser: added test_complex_struct2 to test suite.



commit fe67958cd6732b35bef9fe12230aaa4ae5d58096
Author: Massimo Corà <mcora src gnome org>
Date:   Sat Nov 14 01:04:33 2009 +0100

    cxxparser: added test_complex_struct2 to test suite.
    
    The fix to the tokenizer permitted a correct scope type descending.

 plugins/symbol-db/cxxparser/main.c                 |   49 +++++++++++++++++--
 .../cxxparser/sample-db/test-complex-struct2.c     |   27 +++++++++++
 2 files changed, 70 insertions(+), 6 deletions(-)
---
diff --git a/plugins/symbol-db/cxxparser/main.c b/plugins/symbol-db/cxxparser/main.c
index d31c2a1..8b8a3d3 100644
--- a/plugins/symbol-db/cxxparser/main.c
+++ b/plugins/symbol-db/cxxparser/main.c
@@ -193,6 +193,41 @@ test_simple_klass ()
 	INIT_CXX_TEST("test-simple-klass", on_test_simple_klass_scan_end);
 }
 
+/******************************************************************************/
+static void 
+on_test_complex_struct2_scan_end (SymbolDBEngine* dbe, gpointer user_data)
+{	
+	gchar *associated_source_file = SAMPLE_DB_ABS_PATH"test-complex-struct2.c";	
+	gchar *file_content;
+	SymbolDBEngineIterator *iter;
+	SymbolDBEngineIterator *children;
+	
+	g_file_get_contents (associated_source_file, &file_content, NULL, NULL);
+
+	iter = engine_parser_process_expression ("var->asd_struct->qwe_struct->", 
+	                                         file_content, 
+	    									 associated_source_file, 
+	                                         27);
+
+	g_free (file_content);
+
+	/* process the reult */
+	g_assert (iter != NULL);
+
+	children = get_children_by_iterator (dbe, iter);
+	
+//	DBI_TEST_NAME (children, 0, "a");
+//	DBI_TEST_NAME (children, 1, "b");
+
+	g_object_unref (iter);
+	g_object_unref (children);	
+}
+
+static void
+test_complex_struct2 ()
+{		
+	INIT_C_TEST("test-complex-struct2", on_test_complex_struct2_scan_end);
+}
 
 /******************************************************************************/
 static void 
@@ -321,15 +356,17 @@ int	main (int argc, char *argv[])
 
 	g_message ("SAMPLE_DB_ABS_PATH %s", SAMPLE_DB_ABS_PATH);
  	g_test_init (&argc, &argv, NULL);
-/*
-	g_test_add_func ("/complex_c/test-complex-struct", test_complex_struct);
-	g_test_add_func ("/simple_c/test-simple-struct", test_simple_struct);
-	g_test_add_func ("/simple_c/test-cast-simple-struct", test_cast_simple_struct);
 
+/*	g_test_add_func ("/simple_c/test-simple-struct", test_simple_struct);
+	g_test_add_func ("/simple_c/test-cast-simple-struct", test_cast_simple_struct);
+	
+	g_test_add_func ("/complex_c/test-complex-struct", test_complex_struct);
+	*/
+	g_test_add_func ("/complex_c/test-complex-struct2", test_complex_struct2);
+/*	
 	g_test_add_func ("/simple_cxx/test_simple_klass", test_simple_klass);
+	g_test_add_func ("/complex_cxx/test_complex_klass", test_complex_klass);
 */	
-	g_test_add_func ("/simple_cxx/test_complex_klass", test_complex_klass);
-	
 	
 	g_test_run ();
 	g_message ("test run finished");
diff --git a/plugins/symbol-db/cxxparser/sample-db/test-complex-struct2.c b/plugins/symbol-db/cxxparser/sample-db/test-complex-struct2.c
new file mode 100644
index 0000000..2aa1224
--- /dev/null
+++ b/plugins/symbol-db/cxxparser/sample-db/test-complex-struct2.c
@@ -0,0 +1,27 @@
+int var_alone;
+
+typedef struct _qwe {
+	int e;
+	int f;
+	
+} qwe;
+
+typedef struct _asd {
+	char a; 
+	int b;
+
+	qwe * qwe_struct;
+} asd;
+
+typedef struct _foo {
+	char c;
+	void *d;
+
+	asd *asd_struct;
+} foo;
+
+
+int main () { 
+	foo *var; 
+
+	var->asd_struct->qwe_struct->



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]