generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 328
London | ITP-Jan-26 | Alexandru Pocovnicu | Sprint 3 | Practice TDD #987
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
Open
alexandru-pocovnicu
wants to merge
10
commits into
CodeYourFuture:main
Choose a base branch
from
alexandru-pocovnicu:coursework/sprint-3-practice-tdd
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
57e4cd4
added tests to check for proper fraction
alexandru-pocovnicu bfa31ef
Add test case to verify countChar returns 0 for non-existent character
alexandru-pocovnicu 7c85f26
Implement countChar function to count occurrences of a character in a…
alexandru-pocovnicu 3634d67
Add tests for getOrdinalNumber to cover cases for 2, 3, and general n…
alexandru-pocovnicu e78fcb2
Refactor getOrdinalNumber function to correctly return ordinal suffix…
alexandru-pocovnicu d4b7e36
Add tests for repeatStr function to cover cases for count of 1, 0, an…
alexandru-pocovnicu 1c394fb
Implement repeatStr function to return repeated string based on count…
alexandru-pocovnicu f870969
Remove unrelated angle type change
alexandru-pocovnicu 66ab7bb
Refactor getOrdinalNumber function to simplify last digit and last tw…
alexandru-pocovnicu 88de44b
update test descriptions
alexandru-pocovnicu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| function countChar(stringOfCharacters, findCharacter) { | ||
| return 5 | ||
| let sum = 0; | ||
| for (let char of stringOfCharacters) { | ||
| if (char === findCharacter) { | ||
| sum++; | ||
| } | ||
| } | ||
| return sum; | ||
| } | ||
|
|
||
| module.exports = countChar; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,16 @@ | ||
| function getOrdinalNumber(num) { | ||
| return "1st"; | ||
| let numberToString = String(num); | ||
| let numberLastDigit = numberToString.slice(-1); | ||
| let numberLast2Digits = numberToString.slice(-2); | ||
|
|
||
| if (numberLastDigit === "1" && numberLast2Digits !== "11") | ||
| return numberToString + "st"; | ||
| if (numberLastDigit === "2" && numberLast2Digits !== "12") | ||
| return numberToString + "nd"; | ||
| if (numberLastDigit === "3" && numberLast2Digits !== "13") | ||
| return numberToString + "rd"; | ||
| return numberToString + "th"; | ||
| } | ||
|
|
||
|
|
||
| module.exports = getOrdinalNumber; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| function repeatStr() { | ||
| return "hellohellohello"; | ||
| function repeatStr(str, count) { | ||
| if (count < 0) throw new Error("negative counts are not valid"); | ||
| return str.repeat(count); | ||
| } | ||
|
|
||
| module.exports = repeatStr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you add more test cases to this group to make the coverage more comprehensive?
If the number of cases becomes too large, you can consider organizing them into meaningful subcategories.
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.
done, how do i decide how many are enough?
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 could be subjective sometimes.
I think all suffixes that should be appended with "th" should be be tested.
So numbers that end with 0, 4-9, 11, 12, 13 (especially 11, 12, 13).