Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DataStructure
- 2
- 3 def method_missing(method_sym, *arguments, &block)
- 4 rescue NoMethodError => nME
- 5 nME
- 6 end
- 7
- 8 end
- 9 class SinglyLinkedList < DataStructure
- 10
- 11 end
- require_relative 'dataStructures'
- 2 class Test
- 3 @@test_count = 0
- 4 @@failures = 0
- 5 @@successes = 0
- 6
- 7 def initialize(actual, expected, class_tested, method_tested)
- 8 actual == expected ? @@successes += 1 : @@failures += 1
- 9 puts "Test #{@@test_count}: Testing #{class_tested}'s #{method_tested} method."
- 10 puts "#{actual == expected ? "Success" : "Failure"}: Expected #{expected}, was #{actual}"
- 11 @@test_count += 1
- 12 end
- 13
- 14 def self.final_summary
- 15 puts "There were #{@@test_count} tests with #{@@successes} successes
- 16 and #{@@failures} failures."
- 17 end
- 18 end
- 19
- 20 # Singly Linked List Tests
- 21
- 22 singlyLinkedList = SinglyLinkedList.new
- 23
- 24 testInsert = Test.new(singlyLinkedList.insert("A"), "", "SinglyLinkedList", "insert")
Advertisement
Add Comment
Please, Sign In to add comment