You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when vira is 3 and manilha is 4, relative values are not shifted properly, making so cards 5~3 are valued at 2~10 instead of 1~9, and a 3 has the same value as a diamonds 4 (manilha)
related code @com/bueno/spi/model/TrucoCard.java:
publicintrelativeValue(TrucoCardvira) {
Objects.requireNonNull(vira, "Vira card must not be null.");
if (isManilha(vira))
returnswitch (suit) {
caseDIAMONDS -> 10;
caseSPADES -> 11;
caseHEARTS -> 12;
caseCLUBS -> 13;
caseHIDDEN -> thrownewIllegalStateException("Closed card can not be manilha!");
};
if(rank.value() > vira.rank.value()) returnrank.value() - 1;
returnrank.value();
}
test that i made that fails:
@Test@DisplayName("Should 3 have a relative value of 9 when 3 is vira and 4 is manilha")
voidshouldThreeHaveRelativeValueOfNineWhenThreeIsVira(){
TrucoCardvira = TrucoCard.of(THREE, SPADES);
TrucoCardthree = TrucoCard.of(THREE, DIAMONDS);
assertEquals(9, three.relativeValue(vira));
}
org.opentest4j.AssertionFailedError:
Expected :9
Actual :10
potential fix:
publicintrelativeValue(TrucoCardvira) {
Objects.requireNonNull(vira, "Vira card must not be null.");
if (isManilha(vira))
returnswitch (suit) {
caseDIAMONDS -> 10;
caseSPADES -> 11;
caseHEARTS -> 12;
caseCLUBS -> 13;
caseHIDDEN -> thrownewIllegalStateException("Closed card can not be manilha!");
};
if(rank.value() > vira.rank.value()) returnrank.value() - 1;
if(vira.rank.value() == 10) returnrank.value() - 1;
returnrank.value();
}
The text was updated successfully, but these errors were encountered:
when vira is 3 and manilha is 4, relative values are not shifted properly, making so cards 5~3 are valued at 2~10 instead of 1~9, and a 3 has the same value as a diamonds 4 (manilha)
related code @com/bueno/spi/model/TrucoCard.java:
test that i made that fails:
potential fix:
The text was updated successfully, but these errors were encountered: