C0 code coverage information
Generated on Sun Jul 08 00:09:45 -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.
1 pwd=Dir.pwd
2 Dir.chdir("../../")
3 require "IMDB.rb"
4 Dir.chdir(pwd)
5 require 'test/unit'
6 #class Test::Unit::TestCase
7 $movie = IMDB.new("office_space")
8 class OfficeSpaceTest < Test::Unit::TestCase
9
10
11 def setup
12 @office_space = $movie
13 end
14
15 def test_class_title_search
16 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"]})
17 end
18 def test_title
19 assert_equal(@office_space.title.downcase.strip,"office space")
20 end
21 def test_poster_link
22 assert_equal(@office_space.poster_link,"http://ia.imdb.com/media/imdb/01/I/79/05/84m.jpg")
23 end
24
25 def test_actors
26 actors = {"Stephen Root"=>"Milton Waddams",
27 "Paul Willson"=>"Bob Porter",
28 "Ajay Naidu"=>"Samir Nagheenanajar",
29 "Jennifer Aniston"=>"Joanna",
30 "Alexandra Wentworth"=>"Anne",
31 "Ron Livingston"=>"Peter Gibbons",
32 "Joe Bays"=>"Dom Portwood",
33 "Gary Cole"=>"Bill Lumbergh",
34 "David Herman"=>"Michael Bolton",
35 "Greg Pitts"=>"Drew",
36 "Diedrich Bader"=>"Lawrence",
37 "Kinna McInroe"=>"Nina",
38 "Todd Duffey"=>"Brian - Chotchkie's Waiter",
39 "John C. McGinley"=>"Bob Slydell",
40 "Richard Riehle"=>"Tom Smykowski"}
41 assert_equal(@office_space.actors,actors)
42 assert_equal(@office_space.cast,actors)
43 end
44 def test_rating
45 rating = "Rated R for language and brief sexuality."
46 assert_equal(@office_space.rating,rating)
47 assert_equal(@office_space.mpaa,rating)
48 assert_equal(@office_space.ratings,rating)
49 end
50 def test_aka
51 assert_equal(@office_space.aka,"Cubiculos de la oficina (USA: Spanish title)")
52 end
53 def test_aspect
54 assert_equal(@office_space.aspect_ratio,"1.85 : 1")
55 end
56 def test_awards
57 assert_equal(@office_space.awards,"2 nominations")
58 end
59 def test_certs
60 certs ={"UK"=>"15",
61 "Ireland"=>"15",
62 "Chile"=>"TE",
63 "Australia"=>"M",
64 "Argentina"=>"Atp",
65 "Iceland"=>"L",
66 "Sweden"=>"Btl",
67 "Portugal"=>"M/12",
68 "Spain"=>"T",
69 "USA"=>"R",
70 "Finland"=>"S",
71 "France"=>"U",
72 "Peru"=>"PT",
73 "Canada"=>"AA",
74 "Norway"=>"7",
75 "Germany"=>"12",
76 "Netherlands"=>"AL"}
77 assert_equal(@office_space.certification,certs)
78 assert_equal(@office_space.certifications,certs)
79 assert_equal(@office_space.certs,certs)
80 end
81 def test_color
82 assert_equal(@office_space.color,"Color")
83 end
84 def test_company
85 assert_equal(@office_space.company,"Twentieth Century-Fox Film Corporation")
86 end
87 def test_country
88 assert_equal(@office_space.country,"USA")
89 end
90 def test_date
91 assert_equal(@office_space.date.to_s,"1999-02-19")
92 assert(@office_space.date.class.to_s=="Date")
93
94 end
95 def test_directors
96 assert_equal(@office_space.director,["Mike Judge"])
97 end
98 def test_genre
99 assert_equal(@office_space.genre,["Comedy", "Crime"])
100 end
101
102 def test_keywords
103 assert_equal(@office_space.keywords.sort,["Hypnosis", "Post\240It", "Kung\240Fu", "Cult\240Comedy", "Arson"].sort)
104 end
105 def test_lang
106 assert_equal(@office_space.language,"English")
107 end
108
109 def test_plots
110 plot = "Comedic tale of company workers who hate their jobs and decide to rebel against their greedy boss."
111 plot_key = ["Cult\240Comedy", "Hypnosis", "Post\240It", "Kung\240Fu", "Arson"]
112 plot_out = "Comedic tale of company workers who hate their jobs and decide to rebel against their greedy boss."
113 assert_equal(@office_space.plot,plot)
114 assert_equal(@office_space.plot_keywords,plot_key)
115 assert_equal(@office_space.plot_outline,plot_out)
116 end
117 def test_runtime
118 assert_equal(@office_space.runtime,"89 min")
119 end
120 def test_tagline
121 assert_equal(@office_space.tagline,"Work Sucks.")
122 end
123 def test_user_comments
124 #comment changes
125 @office_space.user_comments
126 #assert_equal(@office_space.user_comments,"The best no-budget movie you'll ever see")
127 end
128 def test_writers
129 assert_equal(@office_space.writer,["Mike Judge"])
130 assert_equal(@office_space.writers,["Mike Judge"])
131 end
132 def test_xml
133 #if comment changes this breaks
134 #pi_xml = "<?xml version='1.0' encoding='ISO-8859-1'?><movie name='Office Space ' api_version='0.2'><cast><actor><name>Stephen Root</name><role>Milton Waddams</role></actor><actor><name>Paul Willson</name><role>Bob Porter</role></actor><actor><name>Ajay Naidu</name><role>Samir Nagheenanajar</role></actor><actor><name>Jennifer Aniston</name><role>Joanna</role></actor><actor><name>Alexandra Wentworth</name><role>Anne</role></actor><actor><name>Ron Livingston</name><role>Peter Gibbons</role></actor><actor><name>Joe Bays</name><role>Dom Portwood</role></actor><actor><name>Gary Cole</name><role>Bill Lumbergh</role></actor><actor><name>David Herman</name><role>Michael Bolton</role></actor><actor><name>Greg Pitts</name><role>Drew</role></actor><actor><name>Diedrich Bader</name><role>Lawrence</role></actor><actor><name>Kinna McInroe</name><role>Nina</role></actor><actor><name>Todd Duffey</name><role>Brian - Chotchkie's Waiter</role></actor><actor><name>John C. McGinley</name><role>Bob Slydell</role></actor><actor><name>Richard Riehle</name><role>Tom Smykowski</role></actor></cast><run_time>89 min</run_time><plot>Comedic tale of company workers who hate their jobs and decide to rebel against their greedy boss.</plot><director>Mike Judge</director><writer>Mike Judge</writer><link>http://www.imdb.com/title/tt0151804/</link><title>Office Space </title><date>1999-02-19</date><rating>Rated R for language and brief sexuality.</rating><user_comments>Best Movie I've Ever Seen</user_comments><tag_line>Work Sucks.</tag_line><plot>Comedic tale of company workers who hate their jobs and decide to rebel against their greedy boss.</plot><genres><type>Comedy</type><type>Crime</type></genres></movie>"
135 #assert_equal(@office_space.to_xml,pi_xml)
136 end
137 def test_html
138 @office_space.to_html
139 end
140 end
Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.