Skip to content

Add default values#1

Open
szymont wants to merge 4 commits intosftnhrd:masterfrom
szymont:add-default-values
Open

Add default values#1
szymont wants to merge 4 commits intosftnhrd:masterfrom
szymont:add-default-values

Conversation

@szymont
Copy link

@szymont szymont commented Mar 27, 2024

  • Add default values for sample(…) function parameters.
    • Default parameter values are added to all the recognised types.
    • If a parameter is not recognised then a placeholder <#default value#> is added instead.
  • Bump macOS deployment target
  • Update .gitignore

@szymont szymont marked this pull request as ready for review March 28, 2024 07:21
Copy link
Owner

@sftnhrd sftnhrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice improvement! Would be great to add tests to check implementation

case .decimal: return "Decimal(\(Int.random(in: 0 ... 100))"
case .double: return Double.random(in: 0.0 ... 10.0).description
case .float: return Float.random(in: 0.0 ... 10.0).description
case .url: return "URL(string: \"https://foo.bar/\")"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It returns optional URL, I'd add ! to avoid errors after generating samples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments