fizzbuzz_transparent_test.go 732 B

123456789101112131415161718192021222324252627282930313233
  1. package domain
  2. import "testing"
  3. func Test_validate(t *testing.T) {
  4. t.Parallel()
  5. type args struct {
  6. int1 int
  7. int2 int
  8. limit int
  9. }
  10. tests := []struct {
  11. name string
  12. args args
  13. wantErr bool
  14. }{
  15. {"happy", args{2, 5, 10}, false},
  16. {"sad: 1 out of range", args{1, 5, 10}, true},
  17. {"sad: 2 out of range", args{2, 11, 10}, true},
  18. {"sad: limit out of range", args{2, 5, 1}, true},
  19. {"sad: repeated", args{2, 2, 10}, true},
  20. }
  21. for _, tt := range tests {
  22. tt := tt
  23. t.Run(tt.name, func(t *testing.T) {
  24. t.Parallel()
  25. if err := validateNumbers(tt.args.int1, tt.args.int2, tt.args.limit); (err != nil) != tt.wantErr {
  26. t.Errorf("validateNumbers() error = %v, wantErr %v", err, tt.wantErr)
  27. }
  28. })
  29. }
  30. }