Added quickref for testing-debugging
authorAmit Sethi
Fri, 12 Nov 2010 15:23:54 +0530
changeset 489 bc8d01c3c9b3
parent 488 85f049b5ec08
child 519 70faad10e854
Added quickref for testing-debugging
testing-debugging/quickref.tex
--- a/testing-debugging/quickref.tex	Fri Nov 12 02:29:04 2010 +0530
+++ b/testing-debugging/quickref.tex	Fri Nov 12 15:23:54 2010 +0530
@@ -1,8 +1,28 @@
-Creating a linear array:\\
-{\ex \lstinline|    x = linspace(0, 2*pi, 50)|}
+Skeleton of a test:\\
+{\ex \lstinline| if __name__ == '__main__':|}
+{\ex \lstinline|      result = gcd(48, 64) |}  
+{\ex \lstinline|      if result != 16:     |}
+{\ex \lstinline|           print ``Test Failed'' |}
+{\ex \lstinline|      print ``Test Passed''      |}
+
+
+\textbf{Testing}
+
+Get results from function or unit of code being tested.Compare it to original output. Test passed if they match else failed.
 
-Plotting two variables:\\
-{\ex \lstinline|    plot(x, sin(x))|}
+\textbf{Code Style} 
+Four Space Indentation
+79 character limit on a line
+Funtions should be seperated by 
+blank line
+Use Docstring
+White space around operators 
+   
+Skeleton of try catch:\\
+{\ex \lstinline|     try:                  |}
+{\ex \lstinline|      	  num = int(a)     |}
+{\ex \lstinline|     except:               |}
+{\ex \lstinline|         print ``Wrong input...'' |}
 
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline|    plot(x, y)|}
+Starting debugger in ipython:\\
+{\ex \lstinline|     %debug                  |}