Exercism: Go version of the 'Raindrops' exercise.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
535 B

9 years ago
  1. package raindrops
  2. import "testing"
  3. const targetTestVersion = 2
  4. func TestConvert(t *testing.T) {
  5. if testVersion != targetTestVersion {
  6. t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
  7. }
  8. for _, test := range tests {
  9. if actual := Convert(test.input); actual != test.expected {
  10. t.Errorf("Convert(%d) = %q, expected %q.",
  11. test.input, actual, test.expected)
  12. }
  13. }
  14. }
  15. func BenchmarkConvert(b *testing.B) {
  16. for i := 0; i < b.N; i++ {
  17. for _, test := range tests {
  18. Convert(test.input)
  19. }
  20. }
  21. }