Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks for the translation, including your writing random tests.
The problem is you are not actually calling your random tests. You need to include it in your allTests array.
Change this:
To this:
Note that I also changed the name from testExample() to testFixed() to fix that cosmetic problem.
Needs random tests in the full test suite.
It's good to tell people the input that resulted in the incorrect output, like this:
Or, in a random test:
It would be nice tell the user the quantity and price that results in incorrect output. Instead of this:
Try this:
Same on the fixed tests.
Also (cosmetic issues):
2) get rid of the //TODO comments at the top of the tests.
3) Change testExample() to testFixed()
Thanks for the translation candidate.
Cosmetic issues found during my review:
Get rid of these comments at the start of the sample tests and full tests:
// XCTest Spec Example:
// TODO: replace with your own tests (TDD), these are just how-to examples to get you started
Change testExample() to testFixed() (both in sample test and full tests)
I normally like to give meaningful test failure output but I'm not sure if there's a better way to do it here given we're solving an infinite loop problem
Thanks for double checking. @Hobovsky just approved the translation!
Here's my Swift translation checklist, based on a moderator reviewing my stuff heavily:
Minor stuff you should do for this translation:
Rename function to lower camel case to conform to Swift programming best practices.
Remove the 2-lines of //TODO sample comments from the top of the sample tests and full tests.
Thank you for submitting a fix for the broken "Kata example twist" Swift tests.
The good news is it looks like you fixed the horribly broken tests.
The bad news is (based on the diffs) I'm concerned about the integrity of the Description, which is shared amongst all the languages. I've asked a moderator to take a close look at it. The diff is confusing when I look at it.
For reference, here's how to add swift-specific lines:
One other minor nitpick is to get rid of the sample comments //TODO at the top.
Thanks for submitting a Swift translation for "do i get a bonus". I'm helping review them but I don't have privileges to approve/reject.
Sample test cases:
Get rid of the comment at the top (Example/TODO)
You need multiple sample test cases. All you currently are doing is assering that 1 == 1
Test cases:
Rename testExample() to testFixed()
Add a few more fixed tests
Add random tests where you randomly generate the salary and whether bonus is true
your function name bonus_time() should be renamed to bonusTime() to conform with Swift function naming practices.
In tests consider giving meaningful feedback by adding a third parameter. Here's one of mine from my "six toast" Swift translation:
XCTAssertEqual(sixToast(4), 2, "Incorrect answer for num = 4")
(where num is the function parameter name)
For reference, here's my "Swift translation checklist" that (usually) gets me past a moderator's reviews:
Here's updated tests from my fork. Feel free to incorporate in yours since you wrote the original translation and appear to still be active:
Consider the random tests:
If the first random is 1, and the second random is 1, then angle b is 0 degrees.
By comparison, the C translation lets the first angle range from 1 through 178, leaving 2 degrees for the 2nd and third angle.
Updated translation based on feedback from Hobovsky (thanks):
My student Marco accidentally solved this by adding an int parameter which grabbed the correct result (18 or 0) off of the test suite parameter. Crazy!
Thank you for the feedback!
I agree that it's a duplicate of the retired kata. I was wondering why my searches failed to find a simple C<->F temp converter. It looks like the retired one also had "testing floats for equality" testcase issues. I'll have to figure out how to search retired katas. The "assert approx equal" mentioned there looks useful!
I don't agree that the existence of the 6 kyu "convert between many temperature scales" kata invalidates the need for a 8kyu C<->F kata (I saw that one before writing mine). C->F is a standard problem given to CS100 students in their first two weeks of class. But you wouldn't give that 6kyu version as a problem for new programmers!