C0 code coverage information
Generated on Sat Jul 07 22:37:29 -0400 2007 with rcov 0.8.0
Code reported as executed by Ruby looks like this...
and this: this line is also marked as covered.
Lines considered as run by rcov, but not reported by Ruby, look like this,
and this: these lines were inferred by rcov (using simple heuristics).
Finally, here's a line marked as not executed.
| Name |
Total lines |
Lines of code |
Total coverage |
Code coverage |
|
test_imdb.rb
|
168
|
156
|
|
|
1 pwd=Dir.pwd
2 Dir.chdir("../../")
3 require "IMDB.rb"
4 Dir.chdir(pwd)
5 require 'test/unit'
6 require "pp"
7 class IMDB
8 def load_page
9 unless @page_html
10 begin
11 File.open("#{@movie_name}.hpr","r"){|x|
12 @page_html = x.read
13 }
14 rescue Exception => e
15 raise "We do not have a test file for #{@movie_name} with the name of #{@movie_name}.hpr @ #{Dir.pwd}"
16 end
17 end
18 doc = Hpricot(@page_html)
19 end
20
21
22 end
23
24 #class Test::Unit::TestCase
25 class IMDBTest < Test::Unit::TestCase
26 def setup
27 @office_space = IMDB.new("office_space")
28 @hpd = IMDB.new("high_plains_drifter")
29 @pi = IMDB.new("PI")
30 end
31
32 def test_class_title_search
33 #assert(IMDB.title_search("office space")=={"Titles (Exact Matches)"=>["Office Space"], "Titles (Partial Matches)"=>["'Office Space': Out of the Office"], "Popular Titles"=>["Office Space"], "Titles (Approx Matches)"=>["Spice Girls: One Hour of Girl Power"]})
34 end
35 def test_title
36 assert_equal(@office_space.title.downcase.strip,"office space")
37 assert_equal(@hpd.title.downcase.strip,"high plains drifter")
38 assert_equal(@pi.title.downcase.strip,"pi")
39 end
40 def test_poster_link
41 assert_equal(@pi.poster_link,"http://ia.imdb.com/media/imdb/01/I/39/46/45m.jpg")
42 end
43
44 def test_actors
45 actors= {"Paul Brinegar"=>"Lutie Naylor",
46 "Geoffrey Lewis"=>"Stacey Bridges, Outlaw",
47 "Marianna Hill"=>"Callie Travers",
48 "John Hillerman"=>"Bootmaker",
49 "Scott Walker"=>"Bill Borders, Outlaw",
50 "Stefan Gierasch"=>"Mayor Jason Hobart",
51 "Mitch Ryan"=>"Dave Drake (as Mitchell Ryan)",
52 "Robert Donner"=>"Preacher",
53 "Clint Eastwood"=>"The Stranger",
54 "Billy Curtis"=>"Mordecai",
55 "Richard Bull"=>"Asa Goodwin",
56 "Ted Hartley"=>"Lewis Belding",
57 "Jack Ging"=>"Morgan Allen",
58 "Verna Bloom"=>"Sarah Belding",
59 "Walter Barnes"=>"Sheriff Sam Shaw"}
60 assert_equal(@hpd.actors,actors)
61 assert_equal(@hpd.cast,actors)
62 end
63 def test_rating
64 rating = "Rated R for language and some disturbing images."
65 assert_equal(@pi.rating,rating)
66 assert_equal(@pi.mpaa,rating)
67 assert_equal(@pi.ratings,rating)
68 end
69 def test_aka
70 assert_equal(@office_space.aka,"Cubiculos de la oficina (USA: Spanish title)")
71 #there is no AKA for high plains dirfter so it should be a blank string
72 assert_equal(@hpd.aka,"")
73 assert_equal(@hpd.also_known_as,"")
74 end
75 def test_aspect
76 assert_equal(@pi.aspect_ratio,"1.66 : 1")
77 assert_equal(@hpd.aspect,"2.35 : 1")
78 end
79 def test_awards
80 assert_equal(@office_space.awards,"2 nominations")
81 assert_equal(@hpd.awards,"")
82 end
83 def test_certs
84 certs ={"UK"=>"15",
85 "Ireland"=>"15",
86 "Chile"=>"TE",
87 "Australia"=>"M",
88 "Argentina"=>"Atp",
89 "Iceland"=>"L",
90 "Sweden"=>"Btl",
91 "Portugal"=>"M/12",
92 "Spain"=>"T",
93 "USA"=>"R",
94 "Finland"=>"S",
95 "France"=>"U",
96 "Peru"=>"PT",
97 "Canada"=>"AA",
98 "Norway"=>"7",
99 "Germany"=>"12",
100 "Netherlands"=>"AL"}
101 assert_equal(@office_space.certification,certs)
102 assert_equal(@office_space.certifications,certs)
103 assert_equal(@office_space.certs,certs)
104 end
105 def test_color
106 assert_equal(@hpd.color,"Color")
107 assert_equal(@pi.color,"Black and White")
108 end
109 def test_company
110 assert_equal(@office_space.company,"Twentieth Century-Fox Film Corporation")
111 end
112 def test_country
113 assert_equal(@hpd.country,"USA")
114 end
115 def test_date
116 assert_equal(@pi.release_date.to_s,"1998-07-10")
117 assert_equal(@office_space.date.to_s,"1999-02-19")
118 assert(@office_space.date.class.to_s=="Date")
119
120 end
121 def test_directors
122 assert_equal(@pi.director,["Darren Aronofsky"])
123 assert_equal(@pi.directors,["Darren Aronofsky"])
124 end
125 def test_genre
126 assert_equal(@pi.genre,["Thriller", "Sci-Fi"])
127 assert_equal(@pi.genres,["Thriller", "Sci-Fi"])
128 end
129
130 def test_keywords
131 assert_equal(@office_space.keywords,["Hypnosis", "Post\240It", "Kung\240Fu", "Cult\240Comedy", "Arson"])
132 end
133 def test_lang
134 assert_equal(@pi.language,"English")
135 end
136
137 def test_plots
138 plot = "A gunfighting stranger comes to the small settlement of Lago and is hired to bring the townsfolk together in an attempt to hold off three outlaws who are on their way."
139 plot_key = ["Flashback\240Sequence", "Murder", "Savior", "Small\240Town", "Sheriff"]
140 plot_out = "A gunfighting stranger comes to the small settlement of Lago and is hired to bring the townsfolk together in an attempt to hold off three outlaws who are on their way."
141 assert_equal(@hpd.plot,plot)
142 assert_equal(@hpd.plot_keywords,plot_key)
143 assert_equal(@hpd.plot_outline,plot_out)
144 end
145 def test_runtime
146 assert_equal(@pi.runtime,"84 min")
147 end
148 def test_tagline
149 assert_equal(@office_space.tagline,"Work Sucks.")
150 end
151 def test_user_comments
152 assert_equal(@pi.user_comments,"The best no-budget movie you'll ever see")
153 assert_equal(@office_space.user_comments,"Whaaaaaat's happening?")
154 assert_equal(@hpd.user_comments,"An entertaining and well thought out western")
155 end
156 def test_writers
157 assert_equal(@office_space.writer,["Mike Judge"])
158 assert_equal(@office_space.writers,["Mike Judge"])
159 end
160 def test_xml
161 pi_xml = "<?xml version='1.0' encoding='ISO-8859-1'?><movie name='Pi ' api_version='0.2'><cast><actor><name>Pamela Hart</name><role>Marcy Dawson</role></actor><actor><name>Ari Handel</name><role>Kabbala Scholar</role></actor><actor><name>Tom Tumminello</name><role>Ephraim</role></actor><actor><name>Stanley Herman</name><role>Moustacheless Man</role></actor><actor><name>Ajay Naidu</name><role>Farroukh</role></actor><actor><name>Samia Shoaib</name><role>Devi</role></actor><actor><name>Mark Margolis</name><role>Sol Robeson</role></actor><actor><name>Joanne Gordon</name><role>Mrs. Ovadia</role></actor><actor><name>Espher Lao Nieves</name><role>Jenna's Mom</role></actor><actor><name>Kristyn Mae-Anne Lao</name><role>Jenna</role></actor><actor><name>Ben Shenkman</name><role>Lenny Meyer</role></actor><actor><name>Clint Mansell</name><role>Photographer</role></actor><actor><name>Stephen Pearlman</name><role>Rabbi Cohen</role></actor><actor><name>Sean Gullette</name><role>Maximillian Cohen</role></actor><actor><name>Lauren Fox</name><role>Jenny Robeson</role></actor></cast><run_time>84 min</run_time><plot>A paranoid mathematician searches for a key number that will unlock the universal patterns found in nature.</plot><director>Darren Aronofsky</director><writer>Darren Aronofsky,Sean Gullette</writer><link/><title>Pi </title><date>1998-07-10</date><rating>Rated R for language and some disturbing images.</rating><user_comments>The best no-budget movie you'll ever see</user_comments><tag_line>faith in chaos</tag_line><plot>A paranoid mathematician searches for a key number that will unlock the universal patterns found in nature.</plot><genres><type>Thriller</type><type>Sci-Fi</type></genres></movie>"
162 assert_equal(@pi.to_xml,pi_xml)
163 end
164 def test_html
165 @pi.to_html
166 end
167
168 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.