-
-
Notifications
You must be signed in to change notification settings - Fork 220
Sheffield | May-2025 | WALEED-YAHYA SALIH-TAHA | Sprint-3 #652
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
Conversation
2. identified obtuse angle and it's function 3. identified stright angle and it's function 4. identified reflex anglewith it's function.
2. Identified Obtuse angles when it's greater than 90 degrees and less than 180, and added a line to test the function. 3. added a line to test all the if conditions in the program.
…odule-Structuring-and-Testing-Data into Sprint3-Test-branch
… line code to check the result.
…o it to handle diffrent type of the cards.
…odule-Structuring-and-Testing-Data into Sprint3-Test-branch
2. tested other scenarios like Zero numerator
…mplement. 2. Added some test examples.
const rank = card.slice(0, -1); // Get the rank (everything except the last character) | ||
if (rank === "A") return 11; | ||
if (["J", "Q", "K"].includes(rank)) return 10; | ||
if (rank >= "2" && rank <= "9") return parseInt(rank, 10); |
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.
If the function is not returning what you expect, that means your test or/and the function are incorrect and should be updated accordingly.
test("should return 5 for 5 of Hearts", () => { | ||
const fiveofHearts = getCardValue("5♥"); | ||
expect(fiveofHearts).toEqual(5); | ||
}); | ||
|
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 also apply the change if you recognise the suggested approach is better?
test("should return 10 for Jack of Diamonds", () => { | ||
const jackOfDiamonds = getCardValue("J♦"); | ||
expect(jackOfDiamonds).toEqual(10); | ||
}); | ||
test("should return 10 for Queen of Clubs", () => { | ||
const queenOfClubs = getCardValue("Q♣"); | ||
expect(queenOfClubs).toEqual(10); | ||
}); | ||
test("should return 10 for King of Spades", () => { | ||
const kingOfSpades = getCardValue("K♠"); | ||
expect(kingOfSpades).toEqual(10); | ||
}); |
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.
I don't see any change in this file since I last reviewed it. Did you forget to commit your changes or push them to Github?
function countChar(stringOfCharacters, findCharacter) { | ||
// Initialize a counter | ||
let count = 0; | ||
|
||
// Scenario: Multiple Occurrences | ||
// Given the input string str, | ||
// And a character char that may occur multiple times with overlaps within str (e.g., 'a' in 'aaaaa'), | ||
// When the function is called with these inputs, | ||
// Then it should correctly count overlapping occurrences of char (e.g., 'a' appears five times in 'aaaaa'). | ||
// Loop through the string | ||
for (let char of stringOfCharacters) { | ||
if (char === findCharacter) { | ||
count++; | ||
} | ||
} |
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.
You can import the function from count.js
as
const countChar = require("./count");
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
Outdated
Show resolved
Hide resolved
2. Added all required checks according to your criteria. 3. Used the allowed special characters only: !, #, $, %, ., *, &.
2. edited the rank to be (2_9) only to ensures only one-digit numeric strings are parsed.
…works too, but toBe() is stricter). 2. Added a test for "10" card (which sometimes causes issues if not handled early). 3. Added extra invalid card checks ("" and "10" without suit) to catch edge cases. 4. Included "A♠" for completeness under the Ace tests.
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.
Most of the changes look good. Good job.
// Case 1: Handle Ace (A) | ||
test("should return 11 for Ace of Spades", () => { | ||
const aceofSpades = getCardValue("A♠"); | ||
expect(aceofSpades).toEqual(11); | ||
}); | ||
|
||
// Case 2: Handle Number Cards (2-10): | ||
// Case 3: Handle Face Cards (J, Q, K): | ||
// Case 4: Handle Ace (A): | ||
// Case 5: Handle Invalid Cards: | ||
expect(getCardValue("A♠")).toBe(11); | ||
}); | ||
|
||
test("should return 11 for Ace of Diamonds", () => { | ||
expect(getCardValue("A♦")).toBe(11); | ||
}); |
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.
Why do you set up two tests for Ace when the function is not expected to check the suit?
}); | ||
|
||
test("should return 10 for 10 of Clubs", () => { | ||
expect(getCardValue("10♣")).toBe(10); |
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.
Why change toEqual()
to toBe()
?
Learners, PR Template
Self checklist
Changelist
Sprint-3 is mainly about implementing, rewriting, practicing and and testing functions.
Questions
Ask any questions you have for your reviewer.