[Lldb-commits] [lldb] r120975 - in /lldb/trunk/test/expression_command/test: ./ Makefile main.cpp

Greg Clayton gclayton at apple.com
Sun Dec 5 18:44:26 PST 2010


Author: gclayton
Date: Sun Dec  5 20:44:26 2010
New Revision: 120975

URL: http://llvm.org/viewvc/llvm-project?rev=120975&view=rev
Log:
Added a simple test case that can be used to test out the expression parser
more completely. Example expressions are in the comments.


Added:
    lldb/trunk/test/expression_command/test/
    lldb/trunk/test/expression_command/test/Makefile
    lldb/trunk/test/expression_command/test/main.cpp

Added: lldb/trunk/test/expression_command/test/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/test/Makefile?rev=120975&view=auto
==============================================================================
--- lldb/trunk/test/expression_command/test/Makefile (added)
+++ lldb/trunk/test/expression_command/test/Makefile Sun Dec  5 20:44:26 2010
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/expression_command/test/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/test/main.cpp?rev=120975&view=auto
==============================================================================
--- lldb/trunk/test/expression_command/test/main.cpp (added)
+++ lldb/trunk/test/expression_command/test/main.cpp Sun Dec  5 20:44:26 2010
@@ -0,0 +1,33 @@
+#include <stdio.h>
+
+int main (int argc, char const *argv[])
+{
+    printf ("Hello world!\n");
+    puts ("hello");
+    // Please test many expressions while stopped at this line:
+#if 0
+    expr 'a'        // make sure character constant makes it down (this is broken by the command line parser code right now)
+    expr 2          // Test int
+    expr 2ull       // Test unsigned long long
+    expr 2.234f     // Test float constants
+    expr 2.234      // Test double constants
+    expr 2+3
+    expr argc
+    expr argc + 22
+    expr argv
+    expr argv[0]
+    expr argv[1]
+    expr argv[-1]
+    expr puts("bonjour")                        // Test constant strings...
+    expr printf("\t\x68\n")       // Test constant strings that contain the \xXX (TAB, 'h', '\n' should be printed)
+    expr printf("\"\n")       // Test constant strings that contains an escaped double quote char
+    expr printf("\'\n")       // Test constant strings that contains an escaped single quote char
+    expr printf ("one: %i\n", 1)
+    expr printf ("1.234 as float: %f\n", 1.234f)
+    expr printf ("1.234 as double: %g\n", 1.234)
+    expr printf ("one: %i, two: %llu\n", 1, 2ull)
+    expr printf ("two: %llu, one: %i\n", 2ull, 1)
+    expr random() % 255l
+#endif
+    return 0;
+}





More information about the lldb-commits mailing list