generated from CodeYourFuture/Module-Template
-
-
Couldn't load subscription status.
- Fork 239
Glasgow | 25-ITP-SEP | Alaa Tagi | Sprint 3 | Coursework/sprint 3 implement and rewrite #756
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
Alaa-Tagi
wants to merge
18
commits into
CodeYourFuture:main
Choose a base branch
from
Alaa-Tagi:coursework/sprint-3-implement-and-rewrite
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 14 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
b5de08b
build up getAngleType case by case
Alaa-Tagi b5fa562
Editing is-proper-fraction code
Alaa-Tagi 3898643
Editing getcardvalue code
Alaa-Tagi 78d374a
rewrite test with jest for getangletype code
Alaa-Tagi d07dd99
update isproperfraction code
Alaa-Tagi a223e45
Rewrite test with jest for isproperfraction code
Alaa-Tagi 17435c8
update the code
Alaa-Tagi 63246ca
Editing the code
Alaa-Tagi b5c55bd
edit the code
Alaa-Tagi a3c8fc8
editing the code
Alaa-Tagi 991832e
Enhance Jest tests for isProperFraction function
Alaa-Tagi f52bd8d
Fix the code
Alaa-Tagi 5274005
Editing the jest code
Alaa-Tagi 7bc1534
Editing code
Alaa-Tagi 5e63f68
update the jest code
Alaa-Tagi 27f970f
manually deletinh all the unwanted content and the markers
Alaa-Tagi 5837808
deleting the markers
Alaa-Tagi 28455ef
deleting the doubled cases inside the code
Alaa-Tagi 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
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
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
120 changes: 115 additions & 5 deletions
120
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/2-is-proper-fraction.test.js
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,13 +1,123 @@ | ||
| // This statement loads the isProperFraction function you wrote in the implement directory. | ||
| // We will use the same function, but write tests for it using Jest in this file. | ||
| const isProperFraction = require("../implement/2-is-proper-fraction"); | ||
|
|
||
| <<<<<<< HEAD | ||
| // Case 1: Proper fraction | ||
| // When numerator < denominator, it should return true. | ||
| test("should return true for a proper fraction", () => { | ||
| ======= | ||
| // Case 1: Proper Fraction | ||
| // Given a numerator smaller than denominator (2/3), | ||
| // When the function is called, | ||
| // Then it should return true because it's a proper fraction. | ||
| test("should return true for a proper fraction (2/3)", () => { | ||
| >>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763 | ||
| expect(isProperFraction(2, 3)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 2: Identify Improper Fractions: | ||
| <<<<<<< HEAD | ||
| // Case 2: Improper fraction | ||
| // When numerator > denominator, it should return false. | ||
| test("should return false for an improper fraction", () => { | ||
| ======= | ||
| // Case 2: Improper Fraction | ||
| // Given a numerator greater than denominator (5/2), | ||
| // When the function is called, | ||
| // Then it should return false because it's an improper fraction. | ||
| test("should return false for an improper fraction (5/2)", () => { | ||
| >>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763 | ||
| expect(isProperFraction(5, 2)).toEqual(false); | ||
| }); | ||
|
|
||
| <<<<<<< HEAD | ||
| // Case 3: Negative proper fraction | ||
| // When numerator is negative but |numerator| < |denominator|, it should return true. | ||
| test("should return true for a negative proper fraction", () => { | ||
| ======= | ||
| // Case 3: Negative Proper Fraction | ||
| // Given a negative proper fraction (-1/2), | ||
| // When the function is called, | ||
| // Then it should return true because the value is between -1 and 1. | ||
| test("should return true for a negative proper fraction (-1/2)", () => { | ||
| >>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763 | ||
| expect(isProperFraction(-1, 2)).toEqual(true); | ||
| }); | ||
|
|
||
| <<<<<<< HEAD | ||
| // Case 4: Equal numerator and denominator | ||
| // When numerator === denominator, it should return false. | ||
| test("should return false for equal numerator and denominator", () => { | ||
| ======= | ||
| // Case 4: Equal Numerator and Denominator | ||
| // Given a numerator equal to denominator (3/3), | ||
| // When the function is called, | ||
| // Then it should return false because it's equal to 1 (not proper). | ||
| test("should return false for equal numerator and denominator (3/3)", () => { | ||
| >>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763 | ||
| expect(isProperFraction(3, 3)).toEqual(false); | ||
| }); | ||
|
|
||
| <<<<<<< HEAD | ||
| // Case 5: Zero numerator | ||
| // 0 divided by any non-zero denominator is a proper fraction. | ||
| test("should return true for zero numerator", () => { | ||
| expect(isProperFraction(0, 5)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 6: Negative denominator | ||
| // When denominator is negative, the fraction is still valid, so check absolute values. | ||
| test("should return true when denominator is negative but |numerator| < |denominator|", () => { | ||
| expect(isProperFraction(2, -3)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 7: Denominator is zero | ||
| // Division by zero is undefined, should return false. | ||
| test("should return false when denominator is zero", () => { | ||
| expect(isProperFraction(3, 0)).toEqual(false); | ||
| }); | ||
|
|
||
| // Case 3: Identify Negative Fractions: | ||
| // Case 8: Both numerator and denominator are negative but |numerator| < |denominator| | ||
| // Negative/negative cancels out, still a proper fraction. | ||
| test("should return true when both numerator and denominator are negative and |numerator| < |denominator|", () => { | ||
| expect(isProperFraction(-3, -7)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 9: Large numbers | ||
| // It should handle large numbers correctly. | ||
| test("should return true for large proper fractions", () => { | ||
| expect(isProperFraction(999, 1000)).toEqual(true); | ||
| }); | ||
|
|
||
| ======= | ||
| // Case 5: Negative Improper Fraction | ||
| // Given a negative improper fraction (-4/3), | ||
| // When the function is called, | ||
| // Then it should return false because the absolute value is greater than 1. | ||
| test("should return false for a negative improper fraction (-4/3)", () => { | ||
| expect(isProperFraction(-4, 3)).toEqual(false); | ||
| }); | ||
|
|
||
| // Case 6: Both Negative (Proper Fraction) | ||
| // Given both numerator and denominator negative (-2/-3), | ||
| // When the function is called, | ||
| // Then it should return true because the value is positive and less than 1. | ||
| test("should return true for both negative proper fraction (-2/-3)", () => { | ||
| expect(isProperFraction(-2, -3)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 7: Zero Numerator | ||
| // Given a numerator of 0 (0/5), | ||
| // When the function is called, | ||
| // Then it should return true because 0 is less than any nonzero denominator. | ||
| test("should return true for zero numerator (0/5)", () => { | ||
| expect(isProperFraction(0, 5)).toEqual(true); | ||
| }); | ||
|
|
||
| // Case 8: Zero Denominator | ||
| // Given a denominator of 0 (5/0), | ||
| // When the function is called, | ||
| // Then it should return false because division by zero is undefined. | ||
| test("should return false for zero denominator (5/0)", () => { | ||
| expect(isProperFraction(5, 0)).toEqual(false); | ||
| }); | ||
|
|
||
| // Case 4: Identify Equal Numerator and Denominator: | ||
| >>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763 | ||
Oops, something went wrong.
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.
The
<<<<<<< HEAD,=======, and>>>>>>>are markers added by Git to show the difference between two versions of a conflicting file.The difference between the two versions of the conflicting file are indicated by these markers as:
<<<<<<< HEAD=======>>>>>>> 52740052fb0ad97a2c7253a04978b14a15b9e763Note: In your file, the long hexadecimal number following
>>>>>>>>is probably the commit SHA of version B.To resolve the conflict, you will need to manually delete all the unwanted content and the markers in an editor.
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.
@cjyuan, I have delete it