jaswdr / faker

:rocket: Ultimate fake data generator for Go with zero dependencies
https://pkg.go.dev/github.com/jaswdr/faker
MIT License
566 stars 59 forks source link

31: fix IntBetween generator #32

Closed ab22 closed 4 years ago

ab22 commented 4 years ago

Description

Fixes issue #31. While this is a sample fix, it doesn't fix failing tests yet.

Are you trying to fix an existing issue?

https://github.com/jaswdr/faker/issues/31

Go Version

$ go version
go version go1.15.2 linux/amd64

Go Tests

$ go test -v
# replace this line with the output
jaswdr commented 4 years ago

@ab22 thanks for the PR, but can you take a look in tests? there are failures in all environment https://travis-ci.org/github/jaswdr/faker/jobs/736241787

ab22 commented 4 years ago

@jaswdr Yeah, I decided to add this a draft first because there's still some questions I have around this.

The IntBetween() function is defined as:

// IntBetween returns a fake Int between a given minimum and maximum values for Faker.

I don't know if this means the value returned will be:

  1. >= min and < max

OR

  1. >= min and <= max

I have this question because on the address.go file it looks like it's using IntBetween as described in number 1, but on person.go it is being used as described in number 2.

I would like to get a more strict definition on IntBetween before proceeding with the PR.

Please let me know 😁 .

jaswdr commented 4 years ago

Should be inclusive, in other words, between is >= min and <= max.

ab22 commented 4 years ago

In that case, I will get the person 100% coverage PR merged first and then I will fix this because it will break some other tests. I will make sure to document this properly as well. 😁

jaswdr commented 4 years ago

closing this because there was no new interaction in one week