Skip to content

Commit e111b4d

Browse files
committed
Fix SNBT number token parsing tests
1 parent 6c4713d commit e111b4d

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

‎src/test/java/org/glavo/nbt/internal/snbt/SNBTParserTest.java‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,26 @@
2727
public final class SNBTParserTest {
2828

2929
private static void assertIntegral(long expectedValue, SNBTParser.IntegralType expectedType, boolean expectedUnsigned, String value) {
30-
assertEquals(new SNBTParser.Token.IntegralToken(expectedValue, expectedType, expectedUnsigned), SNBTParser.parseNumberToken(value));
30+
assertEquals(new SNBTParser.Token.IntegralToken(expectedValue, expectedType, expectedUnsigned), SNBTParser.parseNumberToken(value), value);
3131
}
3232

3333
@ParameterizedTest
3434
@EnumSource
3535
void testParseNumberToken(SNBTParser.IntegralType type) {
3636
List<String> defaultSuffixes = List.of(type.name().substring(0, 1), type.name().substring(0, 1).toLowerCase(Locale.ROOT));
37-
List<String> signedSuffixes = defaultSuffixes.stream().flatMap(suffix -> Stream.of(suffix, "s" + suffix, "S" + suffix)).toList();
37+
List<String> signedSuffixes = defaultSuffixes.stream().flatMap(suffix -> Stream.of("s" + suffix, "S" + suffix)).toList();
3838
List<String> unsignedSuffixes = defaultSuffixes.stream().flatMap(suffix -> Stream.of("u" + suffix, "U" + suffix)).toList();
3939

4040
for (String suffix : defaultSuffixes) {
4141
if (type != SNBTParser.IntegralType.BYTE) {// 0b is binary integer prefix
4242
assertIntegral(0L, type, false, "0" + suffix);
43+
assertIntegral(0L, type, true, "0x0" + suffix);
44+
assertIntegral(0L, type, true, "0X0" + suffix);
4345
}
4446

4547
assertIntegral(0L, type, true, "0b0" + suffix);
4648
assertIntegral(0L, type, true, "0B0" + suffix);
47-
assertIntegral(0L, type, true, "0X0" + suffix);
49+
4850
}
4951

5052
for (String signedSuffix : signedSuffixes) {

0 commit comments

Comments
 (0)