Skip to content

North West | Zabihollah Namazi | Module-Structuring-and-Testing-Data | Sprint 3 #123

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
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

ZabihollahNamazi
Copy link

hi
please if you can check my PR.
thanks

@ZabihollahNamazi ZabihollahNamazi added the Needs Review Participant to add when requesting review label Nov 11, 2024
Copy link
Member

@SallyMcGrath SallyMcGrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your hard work here @ZabihollahNamazi . Don't forget to enrol as a trainee .

Overall, there's an underlying problem here with your approach. What this coursework is trying to show you is that we want to build up our solutions in a systematic, test-first way. This means I am looking for you to convert each statement in the assignment into a test and then write just enough code to pass that test.

For example,

// Proper Fraction check:
// Input: numerator = 2, denominator = 3
// target output: true
// Explanation: The fraction 2/3 is a proper fraction, where the numerator is less than the denominator. The function should return true.

// written as a test
console.assert(isProperFraction(2,3) === true)

// written into the function
function isProperFraction(numerator, denominator) {
if (numerator > denominator) return false
return true
} 

and then go on to the next condition, writing the test first each time. You can build on these tests later, making the error message more useful and using test syntax like in https://nodejs.org/api/test.html but for now work on the coding strategy itself.

if(a + b <= c || a + c <= b || b + c <= a){
return false
}
// else if(a + b >= c || a + c >= b || b + c >= a){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this commented out?

In general, unless you have a question about it, don't commit commented out code

else if(angle == 180){
return "Straight angle"
}
else if(angle > 180 && angle < 360){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this return Reflex angle? What test could you write to check this?

@@ -29,3 +29,31 @@
// Given a card with an invalid rank (neither a number nor a recognized face card),
// When the function is called with such a card,
// Then it should throw an error indicating "Invalid card rank."

function getCardValue(card){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like there's quite a lot to do here. In the assignment there are many tests and criteria defined. Your code should address each criterion systematically. How will you do this?

console.log(isProperFraction(3, 5));

let currentOutput = isProperFraction(2, 3);
let targetOutput = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too, I am looking for a sequence of assertions that check the assertions made in the coursework.

This is a great thing to take to pair programming sessions and work through systematically with a pair. You can use driver navigator pattern to build up your solution.

@@ -16,13 +16,42 @@
// Given a lowercase letter character and a positive integer shift,
// When the function is called with these inputs,
// Then it should rotate the lowercase letter by shift positions within the lowercase alphabet, wrapping around if necessary, and return the rotated lowercase letter as a string.
let ALPHABET = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "U", "V", "w", "x", "y", "z"];
let ALPHABET_UPPERCASE = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 Instead of using two arrays here, could I use one and operate on each character with a string method?

@SallyMcGrath SallyMcGrath added 👀 Review Testing Changes requested to do with testing Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 Review Testing Changes requested to do with testing Reviewed Volunteer to add when completing a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants