day2/tda.tex
author Puneeth Chaganti <punchagan@fossee.in>
Fri, 09 Oct 2009 12:26:47 +0530
changeset 82 e352b67ab357
parent 76 b24c2560f626
child 97 555237dbce44
permissions -rw-r--r--
Minor edits to Copies and Views.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     2
% Tutorial slides on Python.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     3
%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     4
% Author: Prabhu Ramachandran <prabhu at aero.iitb.ac.in>
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     5
% Copyright (c) 2005-2009, Prabhu Ramachandran
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     7
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     8
\documentclass[compress,14pt]{beamer}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
     9
% \documentclass[handout]{beamer}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    10
% \usepackage{pgfpages}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    11
% \pgfpagesuselayout{4 on 1}[a4paper,border, shrink=5mm,landscape]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    12
\usepackage{tikz}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    13
\newcommand{\hyperlinkmovie}{}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    14
%\usepackage{movie15}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    15
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    16
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    17
% Note that in presentation mode 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    18
% \paperwidth  364.19536pt
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    19
% \paperheight 273.14662pt
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    20
% h/w = 0.888
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    21
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    22
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    23
\mode<presentation>
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    24
{
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    25
  \usetheme{Warsaw}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    26
  %\usetheme{Boadilla}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    27
  %\usetheme{default}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    28
  \useoutertheme{split}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    29
  \setbeamercovered{transparent}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    30
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    31
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    32
% To remove navigation symbols
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    33
\setbeamertemplate{navigation symbols}{}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    34
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    35
\usepackage{amsmath}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    36
\usepackage[english]{babel}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    37
\usepackage[latin1]{inputenc}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    38
\usepackage{times}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    39
\usepackage[T1]{fontenc}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    40
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    41
% Taken from Fernando's slides.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    42
\usepackage{ae,aecompl}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    43
\usepackage{mathpazo,courier,euler}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    44
\usepackage[scaled=.95]{helvet}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    45
\usepackage{pgf}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    46
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    47
\definecolor{darkgreen}{rgb}{0,0.5,0}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    48
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    49
\usepackage{listings}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    50
\lstset{language=Python,
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    51
    basicstyle=\ttfamily\bfseries,
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    52
    commentstyle=\color{red}\itshape,
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    53
  stringstyle=\color{darkgreen},
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    54
  showstringspaces=false,
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    55
  keywordstyle=\color{blue}\bfseries}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    56
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    57
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    58
% My Macros
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    59
\setbeamercolor{postit}{bg=yellow,fg=black}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    60
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    61
\newcommand{\emphbar}[1]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    62
{\begin{beamercolorbox}[rounded=true]{emphbar} 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    63
      {#1}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    64
 \end{beamercolorbox}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    65
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    66
%{\centerline{\fcolorbox{gray!50} {blue!10}{
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    67
%\begin{minipage}{0.9\linewidth}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    68
%    {#1} 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    69
%\end{minipage}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    70
%    }}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    71
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    72
\newcommand{\myemph}[1]{\structure{\emph{#1}}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    73
\newcommand{\PythonCode}[1]{\lstinline{#1}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    74
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    75
\newcommand{\tvtk}{\texttt{tvtk}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    76
\newcommand{\mlab}{\texttt{mlab}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    77
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    78
\newcounter{time}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    79
\setcounter{time}{0}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    80
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\vspace*{0.1in}\tiny \thetime\ m}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    81
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    82
\newcommand\BackgroundPicture[1]{%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    83
  \setbeamertemplate{background}{%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    84
      \parbox[c][\paperheight]{\paperwidth}{%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    85
      \vfill \hfill
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    86
 \hfill \vfill
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    87
}}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    88
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    89
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    90
% Configuring the theme
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    91
%\setbeamercolor{normal text}{fg=white}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    92
%\setbeamercolor{background canvas}{bg=black}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    93
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    94
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    95
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    96
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    97
% Title page
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    98
\title[]{Test Driven Approach}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
    99
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   100
\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   101
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   102
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   103
\date[] {11, October 2009}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   104
\date[] % (optional)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   105
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   106
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   107
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   108
%\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   109
%\logo{\pgfuseimage{iitblogo}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   110
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   111
\AtBeginSection[]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   112
{
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   113
  \begin{frame}<beamer>
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   114
    \frametitle{Outline}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   115
      \Large
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   116
    \tableofcontents[currentsection,currentsubsection]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   117
  \end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   118
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   119
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   120
%% Delete this, if you do not want the table of contents to pop up at
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   121
%% the beginning of each subsection:
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   122
\AtBeginSubsection[]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   123
{
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   124
  \begin{frame}<beamer>
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   125
    \frametitle{Outline}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   126
    \tableofcontents[currentsection,currentsubsection]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   127
  \end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   128
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   129
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   130
\AtBeginSection[]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   131
{
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   132
  \begin{frame}<beamer>
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   133
    \frametitle{Outline}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   134
    \tableofcontents[currentsection,currentsubsection]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   135
  \end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   136
}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   137
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   138
% DOCUMENT STARTS
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   139
\begin{document}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   140
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   141
\begin{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   142
  \maketitle
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   143
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   144
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   145
\section{Test Driven Approach}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   146
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   147
\begin{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   148
    \frametitle{Testing code with \typ{nosetests}}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   149
   
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   150
    \begin{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   151
        \item Writing tests is really simple!
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   152
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   153
        \item Using nose.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   154
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   155
        \item Example!
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   156
    \end{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   157
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   158
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   159
\begin{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   160
    \frametitle{Need of Testing!}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   161
   
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   162
    \begin{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   163
        \item Quality
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   164
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   165
        \item Regression
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   166
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   167
        \item Documentation
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   168
    \end{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   169
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   170
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   171
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   172
    \frametitle{Nosetest}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   173
  \begin{lstlisting}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   174
def gcd(a, b):
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   175
    """Returns gcd of a and b, 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   176
     handles only positive numbers."""
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   177
    if a%b == 0: return b
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   178
    return gcd(b, a%b)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   179
def lcm(a, b):
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   180
    return a*b/gcd(a, b)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   181
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   182
if __name__ == '__main__':
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   183
    import nose
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   184
    nose.main()
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   185
  \end{lstlisting}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   186
\inctime{10}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   187
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   188
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   189
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   190
    \frametitle{Example}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   191
    \begin{block}{Problem Statement:}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   192
      Write a function to check whether a given input
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   193
      string is a palindrome.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   194
    \end{block}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   195
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   196
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   197
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   198
    \frametitle{Function: palindrome.py}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   199
\begin{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   200
def is_palindrome(input_str):
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   201
  return input_str == input_str[::-1]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   202
\end{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   203
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   204
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   205
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   206
    \frametitle{Test for the palindrome: palindrome.py}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   207
\begin{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   208
from plaindrome import is_palindrome
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   209
def test_function_normal_words():
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   210
  input = "noon"
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   211
  assert is_palindrome(input) == True
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   212
\end{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   213
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   214
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   215
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   216
    \frametitle{Running the tests.}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   217
\begin{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   218
$ nosetests test.py 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   219
.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   220
----------------------------------------------
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   221
Ran 1 test in 0.001s
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   222
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   223
OK
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   224
\end{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   225
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   226
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   227
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   228
    \frametitle{Exercise: Including new tests.}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   229
\begin{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   230
def test_function_ignore_cases_words():
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   231
  input = "Noon"
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   232
  assert is_palindrome(input) == True
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   233
\end{lstlisting}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   234
     \vspace*{0.25in}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   235
     Check\\
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   236
     \PythonCode{$ nosetests test.py} \\
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   237
     \begin{block}{Task}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   238
     Tweak the code to pass this test.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   239
     \end{block}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   240
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   241
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   242
%\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   243
%    \frametitle{Lets write some test!}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   244
%\begin{lstlisting}    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   245
%#for form of equation y=mx+c
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   246
%#given m and c for two equation,
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   247
%#finding the intersection point.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   248
%def intersect(m1,c1,m2,c2):
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   249
%    x = (c2-c1)/(m1-m2)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   250
%    y = m1*x+c1
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   251
%    return (x,y)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   252
%\end{lstlisting}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   253
%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   254
%Create a simple test for this
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   255
%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   256
%function which will make it fail.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   257
%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   258
%\inctime{15} 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   259
%\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   260
%
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   261
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   262
\begin{frame}[fragile]
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   263
    \frametitle{Exercise}
76
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   264
    Based on Euclid's algorithm:
62
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   265
        $gcd(a,b)=gcd(b,b\%a)$\\
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   266
    gcd function can be written as:
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   267
    \begin{lstlisting}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   268
    def gcd(a, b):
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   269
      if a%b == 0: return b
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   270
      return gcd(b, a%b)
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   271
    \end{lstlisting}
76
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   272
    \vspace*{-0.15in}
62
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   273
    \begin{block}{Task}
76
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   274
      \begin{itemize}
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   275
      \item Write at least 
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   276
        two tests for above mentioned function.
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   277
      \item Write a non recursive implementation
62
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   278
      of gcd(), and test it using already 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   279
      written tests.
76
b24c2560f626 Added links.tex, compilation of various links.
Shantanu <shantanu@fossee.in>
parents: 62
diff changeset
   280
      \end{itemize}
62
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   281
    \end{block}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   282
    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   283
\inctime{15} 
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   284
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   285
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   286
\begin{frame}{In this session we have covered:}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   287
  \begin{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   288
    \item Need for visualization.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   289
    \item Tools available.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   290
    \item How to follow Test Driven Approach.
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   291
  \end{itemize}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   292
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   293
\begin{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   294
    \begin{center}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   295
        \Huge    
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   296
        Thank you!
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   297
    \end{center}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   298
\end{frame}
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   299
12bd6784d213 Forgot to add files, doing them now.
Shantanu <shantanu@fossee.in>
parents:
diff changeset
   300
\end{document}