diff options
author | simon.hengel <simon.hengel@wiktory.org> | 2010-04-02 14:11:53 +0000 |
---|---|---|
committer | simon.hengel <simon.hengel@wiktory.org> | 2010-04-02 14:11:53 +0000 |
commit | b5ec4e7d0f847215677752b191677379f045efb0 (patch) | |
tree | bc23e9afdf309db6ee94f4201e431a98821550d7 | |
parent | 28bd97759174c9169b7633ee45d39c82fd069dd9 (diff) |
Add tests for interactive examples
-rw-r--r-- | tests/tests/Examples.hs | 34 | ||||
-rw-r--r-- | tests/tests/Examples.html.ref | 208 |
2 files changed, 242 insertions, 0 deletions
diff --git a/tests/tests/Examples.hs b/tests/tests/Examples.hs new file mode 100644 index 00000000..ed22b614 --- /dev/null +++ b/tests/tests/Examples.hs @@ -0,0 +1,34 @@ +module Examples where + +-- | Fibonacci number of given 'Integer'. +-- +-- Examples: +-- +-- ghci> fib 5 +-- 5 +-- ghci> fib 10 +-- 55 +-- +-- ghci> fib 10 +-- 55 +-- +-- One more Example: +-- +-- ghci> fib 5 +-- 5 +-- +-- One more Example: +-- +-- ghci> fib 5 +-- 5 +-- +-- Example with an import: +-- +-- ghci> import Data.Char +-- ghci> isSpace 'a' +-- False +-- +fib :: Integer -> Integer +fib 0 = 0 +fib 1 = 1 +fib n = fib (n - 1) + fib (n - 2) diff --git a/tests/tests/Examples.html.ref b/tests/tests/Examples.html.ref new file mode 100644 index 00000000..64634d26 --- /dev/null +++ b/tests/tests/Examples.html.ref @@ -0,0 +1,208 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!--Rendered using the Haskell Html Library v0.2--> +<HTML +><HEAD +><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8" +><TITLE +>Examples</TITLE +><LINK HREF="haddock.css" REL="stylesheet" TYPE="text/css" +><SCRIPT SRC="haddock-util.js" TYPE="text/javascript" +></SCRIPT +><SCRIPT TYPE="text/javascript" +>window.onload = function () {setSynopsis("mini_Examples.html")};</SCRIPT +></HEAD +><BODY +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="topbar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><IMG SRC="haskell_icon.gif" WIDTH="16" HEIGHT="16" ALT=" " +></TD +><TD CLASS="title" +></TD +><TD CLASS="topbut" +><A HREF="index.html" +>Contents</A +></TD +><TD CLASS="topbut" +><A HREF="doc-index.html" +>Index</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="modulebar" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD +><FONT SIZE="6" +>Examples</FONT +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Synopsis</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="body" +><TABLE CLASS="vanilla" CELLSPACING="0" CELLPADDING="0" +><TR +><TD CLASS="decl" +><A HREF="#v%3Afib" +>fib</A +> :: <A HREF=" /home/sol/.install/ghc/ghc-6.12.1/lib/ghc-6.12.1/../../share/doc/ghc/html/libraries/base-4.2.0.0/Prelude.html#t%3AInteger" +>Integer</A +> -> <A HREF=" /home/sol/.install/ghc/ghc-6.12.1/lib/ghc-6.12.1/../../share/doc/ghc/html/libraries/base-4.2.0.0/Prelude.html#t%3AInteger" +>Integer</A +></TD +></TR +></TABLE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="section1" +>Documentation</TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="decl" +><A NAME="v:fib" +><A NAME="v%3Afib" +></A +></A +><B +>fib</B +> :: <A HREF=" /home/sol/.install/ghc/ghc-6.12.1/lib/ghc-6.12.1/../../share/doc/ghc/html/libraries/base-4.2.0.0/Prelude.html#t%3AInteger" +>Integer</A +> -> <A HREF=" /home/sol/.install/ghc/ghc-6.12.1/lib/ghc-6.12.1/../../share/doc/ghc/html/libraries/base-4.2.0.0/Prelude.html#t%3AInteger" +>Integer</A +></TD +></TR +><TR +><TD CLASS="doc" +><P +>Fibonacci number of given <TT +><A HREF=" /home/sol/.install/ghc/ghc-6.12.1/lib/ghc-6.12.1/../../share/doc/ghc/html/libraries/base-4.2.0.0/Prelude.html#t%3AInteger" +>Integer</A +></TT +>. +</P +><P +>Examples: +</P +><PRE CLASS="screen" +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>fib 5 +</CODE +></STRONG +>5 +<CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>fib 10 +</CODE +></STRONG +>55 +</PRE +><PRE CLASS="screen" +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>fib 10 +</CODE +></STRONG +>55 +</PRE +><P +>One more Example: +</P +><PRE CLASS="screen" +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>fib 5 +</CODE +></STRONG +>5 +</PRE +><P +>One more Example: +</P +><PRE CLASS="screen" +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>fib 5 +</CODE +></STRONG +>5 +</PRE +><P +>Example with an import: +</P +><PRE CLASS="screen" +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>import Data.Char +</CODE +></STRONG +><CODE CLASS="prompt" +>ghci> </CODE +><STRONG CLASS="userinput" +><CODE +>isSpace 'a' +</CODE +></STRONG +>False +</PRE +></TD +></TR +><TR +><TD CLASS="s15" +></TD +></TR +><TR +><TD CLASS="botbar" +>Produced by <A HREF="http://www.haskell.org/haddock/" +>Haddock</A +> version 2.7.2</TD +></TR +></TABLE +></BODY +></HTML +> |