Skip to content

implement and test method setDenominator#7

Open
projet2019 wants to merge 3 commits into
EphecLLN:testfrom
ProjetJava2019:master
Open

implement and test method setDenominator#7
projet2019 wants to merge 3 commits into
EphecLLN:testfrom
ProjetJava2019:master

Conversation

@projet2019

Copy link
Copy Markdown

cette méthode permet d'assigner une valeur au dénominateur d'une fraction et reste inchangé lorsque cette valeur est nulle

Comment on lines -69 to +83


if (denominator != 0) {
this.denominator = denominator;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Attention : La fraction doit être simplifiée en cas de modifications du dénominateur

Comment on lines +110 to +111
f.setDenominator(9);
assertEquals(f.getDenominator(),9);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Pourquoi ce changement?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

j'ai remarqué que mon test echouait chaque fois car je n'avais la bonne valeur au denominateur .

f = new Fraction(2,3);
f.setDenominator(4);
assertEquals(f.getDenominator(),2); //ici le dénominateur est différent

//Test the case of the null denominator
//Method fails silently, i.e. no change to the fraction	

f = new Fraction(1,2); // ceci manquait
f.setDenominator(0);
assertEquals(f.getDenominator(),2);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Je ne suis pas d'accord avec le premier changement : Lorsqu'on change la fraction 2/3 en 2/4, elle doit être simplifiée et devenir 1/2, d'où le assertEquals(dénominateur, 2).

Comment thread src/test/java/tp/FractionTest.java
@vvandenschrieck vvandenschrieck changed the base branch from master to test October 25, 2019 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants