-
-
Save anonymous/87a017608caa3148827a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CartesianProduct | |
include Enumerable | |
@value1 ; @value2 | |
def initialize(value1 , value2) | |
@value1 = value1 | |
@value2 = value2 | |
end | |
def each | |
tempArray = () | |
@value1.each do |x| | |
@value2.each do |y| | |
if((@value2 != nil)&&(@value1 != nil)) | |
puts x , y | |
tempArray << [x , y] | |
else | |
end | |
end | |
end | |
return tempArray | |
end | |
end | |
results : | |
On Time | |
CartesianProduct | |
should work for the first example given in the homework [15 points] (FAILED) | |
Failures: | |
1) CartesianProduct should work for the first example given in the homework [15 points] | |
Failure/Error: c.to_a.should include([:a, 4],[:a,5],[:b,5],[:b,4]) | |
expected [] to include [:a, 4], [:a, 5], [:b, 5], and [:b, 4] | |
Diff: | |
@@ -1,2 +1,2 @@ | |
-[[:a, 4], [:a, 5], [:b, 5], [:b, 4]] | |
+[] | |
# /tmp/rspec20130414-919-u24775.rb:40:in `block (2 levels) in <top (required)>' | |
# /tmp/rspec20130414-919-u24775.rb:33:in `block (3 levels) in <top (required)>' | |
# /tmp/rspec20130414-919-u24775.rb:32:in `block (2 levels) in <top (required)>' | |
# lib/graders/rspec_grader/rspec_sandbox.rb:9:in `block (3 levels) in <top (required)>' | |
# lib/graders/rspec_grader/rspec_sandbox.rb:8:in `block (2 levels) in <top (required)>' | |
# lib/graders/rspec_grader/rspec_runner.rb:42:in `block in run_rspec' | |
# lib/graders/rspec_grader/rspec_runner.rb:33:in `run_rspec' | |
# lib/graders/rspec_grader/rspec_runner.rb:24:in `run' | |
# lib/graders/rspec_grader/weighted_rspec_grader.rb:6:in `grade!' | |
# ./grade:31:in `<main>' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment