Last active
December 28, 2015 06:19
-
-
Save toddsampson/7456513 to your computer and use it in GitHub Desktop.
Testing the Halting Problem blog post: http://www.cloudspace.com/blog/2009/09/29/testing-the-halting-problem/
This file contains 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
def reader(record, previous_ids = []) | |
raise "loop" if previous_ids.include?(record.id) | |
... | |
return reader(next_record, previous_ids + [record.id]) | |
end |
This file contains 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
it "doesn't loop forever" do | |
# setup test and create loop | |
puts "This is a test of the halting problem. If you see this message for more than a few seconds, it means the test has failed." | |
# run test on the loop | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment