exercism / go

Exercism exercises in Go.
https://exercism.org/tracks/go
MIT License
978 stars 653 forks source link

Expanding test cases for Vehicle Purchase exercise in the Go track #2739

Closed jesse-kroon closed 8 months ago

jesse-kroon commented 8 months ago

I was working on the Vehicle Purchase exercise in the Go track today, and in the description I noticed the following requirement: "For a rough estimate, assume if the vehicle is less than 3 years old, it costs 80% of the original price it had when it was brand new."

However, when looking at the test cases, I found that there is no test case with an age of exactly 3. This means that the following check also works, while I expect it not to pass

if age < = 3 { // use 80% of original price }

While if age is exactly 3, it should adhere to the following requirement as stated in the description: "If the vehicle is at least 3 years old but less than 10 years, it costs 70% of the original price."

I would suggest to add the following test case to vehicle_purchase_test.go

{
    name:          "price is reduced to 70% for age 3",
    originalPrice: 40000,
    age:           3,
    expected:      28000,
},
github-actions[bot] commented 8 months ago

Hello. Thanks for opening an issue on Exercism 🙂

At Exercism we use our Community Forum, not GitHub issues, as the primary place for discussion. That allows maintainers and contributors from across Exercism's ecosystem to discuss your problems/ideas/suggestions without them having to subscribe to hundreds of repositories.

This issue will be automatically closed. Please use this link to copy your GitHub Issue into a new topic on the forum, where we look forward to chatting with you!

If you're interested in learning more about this auto-responder, please read this blog post.