Skip to content

Commit

Permalink
Added tests to check equality between ints, floats and doubles
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioLupu committed Jun 6, 2024
1 parent dadf1c2 commit ec0b054
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,30 @@ public void numberTest() {
((RosettaInterpreterNumberValue)val).getValue());
}

@Test
public void intEqualsFloatTest() {
RosettaExpression expr = parser.parseExpression("5 = 5.0");
RosettaInterpreterValue val = interpreter.interp(expr);
assertEquals(true,
((RosettaInterpreterBooleanValue)val).getValue());
}

@Test
public void intEqualsDoubleTest() {
RosettaExpression expr = parser.parseExpression("5 = 5.00");
RosettaInterpreterValue val = interpreter.interp(expr);
assertEquals(true,
((RosettaInterpreterBooleanValue)val).getValue());
}

@Test
public void floatEqualsDoubleTest() {
RosettaExpression expr = parser.parseExpression("5.0 = 5.00");
RosettaInterpreterValue val = interpreter.interp(expr);
assertEquals(true,
((RosettaInterpreterBooleanValue)val).getValue());
}

@Test
public void stringTest() {
RosettaExpression expr = parser.parseExpression("\"hello\"");
Expand Down

0 comments on commit ec0b054

Please sign in to comment.