-
-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dnd-character
exercise
#751
base: main
Are you sure you want to change the base?
Conversation
4467bb9
to
fbdc253
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very difficult to review this. It includes more tests than the canonical data, the descriptions don't seem to match the canonical data, and there are even tests like (>= (count (set (repeatedly 100 #(dnd-character/ability)))) 5)
, which I can't locate in the canonical data.
Extensive deviations from the canonical data make it very challenging to perform manual comparisons when something needs to be inspected.
Were there specific reasons for these deviations?
Yes, because this an exercise which canonical data in large part describe "properties," not concrete test values. This is due to the fact that we're dealing with randomness, which doesn't fit well into the regular canonical data format.
I understand, but in this case I feel extra tests are warranted. {
"uuid": "4f28f19c-2e47-4453-a46a-c0d365259c14",
"description": "random ability is within range",
"scenarios": ["random"],
"property": "ability",
"input": {},
"expected": "score >= 3 && score <= 18"
}, In essence, this is specifying two things:
This is why the additional test is added. We could combine them into a single test, but I feel that a separate test makes more sense. Basically what I want to test is that the function does not keep on returning the same values, but that it is doing something random. A similar argument applies to the tests for the {
"uuid": "385d7e72-864f-4e88-8279-81a7d75b04ad",
"description": "random character is valid",
"scenarios": ["random"],
"property": "character",
"input": {},
"expected": {
"strength": "strength >= 3 && strength <= 18",
"dexterity": "dexterity >= 3 && dexterity <= 18",
"constitution": "constitution >= 3 && constitution <= 18",
"intelligence": "intelligence >= 3 && intelligence <= 18",
"wisdom": "wisdom >= 3 && wisdom <= 18",
"charisma": "charisma >= 3 && charisma <= 18",
"hitpoints": "hitpoints == 10 + modifier(constitution)"
}
} As you can see, this test case actually has at least 7 different tests, and with the added test for random generation, we get 8 tests encoded by a single test case property. |
@tasxatzial What do you think about naming the functions |
My preference is to use verbs for function names, but I understand this can sometimes result in verbose names. As such, I'm not too particular about naming. I don't believe the official documentation strictly follows this guideline either. In my view, reasons to switch from
|
fbdc253
to
fd2443f
Compare
Okay. I've updated the PR |
Couple extra suggestions before i do a proper review:
|
fd2443f
to
dbad29c
Compare
Is this something that you would like to see changed for all exercises? |
I've updated |
dbad29c
to
115627b
Compare
@tasxatzial I've created a PR to update the separator: #779 Let's get that merged first and then I'll update this PR |
No description provided.