class Sus::Config
def print_test_feedback(output, assertions)
def print_test_feedback(output, assertions) duration = @clock.duration rate = assertions.count / duration total = assertions.total count = assertions.count if total < 10 or count < 10 output.puts "😠You should write more tests and assertions!" # Statistics will be less meaningful with such a small amount of data, so give up: return end # Check whether there is at least, on average, one assertion (or more) per test: assertions_per_test = assertions.count / assertions.total if assertions_per_test < 1.0 output.puts "😩 Your tests don't have enough assertions (#{assertions_per_test.round(1)} < 1.0)!" end # Give some feedback about the number of tests: if total < 20 output.puts "🥲 You should write more tests (#{total}/20)!" elsif total < 50 output.puts "🙂 Your test suite is starting to shape up, keep on at it (#{total}/50)!" elsif total < 100 output.puts "😀 Your test suite is maturing, keep on at it (#{total}/100)!" else output.puts "🤩 Your test suite is amazing!" end # Give some feedback about the performance of the tests: if rate < 10.0 output.puts "💔 Ouch! Your test suite performance is painful (#{rate.round(1)} < 10)!" elsif rate < 100.0 output.puts "💩 Oops! Your test suite performance could be better (#{rate.round(1)} < 100)!" elsif rate < 1_000.0 output.puts "💪 Good job! Your test suite has good performance (#{rate.round(1)} < 1000)!" elsif rate < 10_000.0 output.puts "🎉 Great job! Your test suite has excellent performance (#{rate.round(1)} < 10000)!" else output.puts "🔥 Wow! Your test suite has outstanding performance (#{rate.round(1)} >= 10000.0)!" end end