summaryrefslogtreecommitdiff
path: root/testing-debugging/quickref.tex
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-11-17 23:24:57 +0530
committerPuneeth Chaganti2010-11-17 23:24:57 +0530
commit347866ed0d29db61ee062563b1e1616cfb85588c (patch)
treed5fe9159a195939b5979e804bad3a7f9842a679f /testing-debugging/quickref.tex
parent75034126a8c663fc03d922f41d9bf5051cc7e88d (diff)
parent66b5c35494866a8c94a3d9dce33dbc40d86542cb (diff)
downloadst-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.tar.gz
st-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.tar.bz2
st-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.zip
Merged heads.
Diffstat (limited to 'testing-debugging/quickref.tex')
-rw-r--r--testing-debugging/quickref.tex32
1 files changed, 26 insertions, 6 deletions
diff --git a/testing-debugging/quickref.tex b/testing-debugging/quickref.tex
index b26d168..e7e0d6e 100644
--- a/testing-debugging/quickref.tex
+++ b/testing-debugging/quickref.tex
@@ -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'' |}
-Plotting two variables:\\
-{\ex \lstinline| plot(x, sin(x))|}
-Plotting two lists of equal length x, y:\\
-{\ex \lstinline| plot(x, y)|}
+\textbf{Testing}
+
+Get results from function or unit of code being tested.Compare it to original output. Test passed if they match else failed.
+
+\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...'' |}
+
+Starting debugger in ipython:\\
+{\ex \lstinline| %debug |}