Advertisement
Narzew

Ruby Tester Source (v 1.0)

Nov 1st, 2012
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.60 KB | None | 0 0
  1. #**OUTDATED!!! THE VERSION 2.0 SOURCE IS CURRENTLY UNAVIABLE.
  2.  
  3. print "RubyTester by Narzew\n"
  4. print "www.ncr.rox.pl\n"
  5. print "Program will run 1 milion operations to test.\n"
  6. print "Press Enter to start test.\n"
  7.  
  8. $stdin.gets
  9.  
  10. intnr = 1000000
  11.  
  12. time = Time.now
  13. x = 0
  14. intnr.times{
  15.  x += 1
  16.  print x
  17. }
  18. time_needed = Time.now - time
  19. speed = (intnr / time_needed).to_i
  20. print "Completed.\n"
  21. print "\nTest Results:\n"
  22. print "\n\nTime needed: #{time_needed}\nSpeed: #{speed} int/second\n"
  23. print "\n\nPress enter to run 2nd Test.\n"
  24.  
  25. $stdin.gets
  26.  
  27. time = Time.now
  28. x = 0
  29. intnr.times{
  30.  x += 1
  31.  print "#{x}\n"
  32. }
  33. time_needed2 = Time.now - time
  34. speed2 = (intnr / time_needed2).to_i
  35.  
  36. print "Completed.\n"
  37. print "\n\n2ND Test Results:\n"
  38. print "Time needed: #{time_needed2}\n Speed: #{speed2} int/second\n"
  39. print "\n\nPress enter to run 3rd and last Test.\n"
  40.  
  41. $stdin.gets
  42.  
  43. time = Time.now
  44. x = 0
  45. intnr.times{
  46.  x += 1
  47.  print "c#{x}\n"
  48. }
  49. time_needed3 = Time.now - time
  50. speed3 = (intnr / time_needed3).to_i
  51.  
  52. print "Completed.\n"
  53. print "\nTest Results:\n"
  54. print "\n\nTime needed: #{time_needed} seconds\nSpeed: #{speed} char/second\n"
  55.  
  56. print "\n\n\nTOTAL RESULTS:\n"
  57. print "Test1:\n"
  58. print "Time: #{time_needed}\n"
  59. print "Speed: #{speed} int/second\n\n"
  60. print "Test2:\n"
  61. print "Time: #{time_needed2} seconds\n"
  62. print "Speed: #{speed2} int/second\n\n"
  63. print "Test3:\n"
  64. print "Time: #{time_needed3} seconds\n"
  65. print "Speed: #{speed3} char/second\n\n\n\n\n\n"
  66. print "Please visit ncr.rox.pl!\n"
  67. print "Software is freeware.\n Created by Narzew\n"
  68. print "Press Enter to exit.\n"
  69.  
  70. $stdin.gets
  71.  
  72. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement