Skip to content

Commit

Permalink
Merge 9451e8d into 6f39e38
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Dec 9, 2018
2 parents 6f39e38 + 9451e8d commit 72008ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/querz/nbt/DoubleTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public String valueToTagString(int depth) {

@Override
public boolean equals(Object other) {
return super.equals(other) && asDouble() == ((DoubleTag) other).asDouble();
return super.equals(other) && Double.valueOf(asDouble()).equals(((DoubleTag) other).asDouble());
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/querz/nbt/FloatTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public String valueToTagString(int depth) {

@Override
public boolean equals(Object other) {
return super.equals(other) && asFloat() == ((FloatTag) other).asFloat();
return super.equals(other) && Float.valueOf(asFloat()).equals(((FloatTag) other).asFloat());
}

@Override
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/net/querz/nbt/DoubleTagTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.querz.nbt;

import static org.junit.Assert.assertNotEquals;

import java.util.Arrays;

public class DoubleTagTest extends NBTTestCase {
Expand All @@ -14,10 +16,9 @@ public void testStringConversion() {

public void testEquals() {
DoubleTag t = new DoubleTag(Double.MAX_VALUE);
DoubleTag t2 = new DoubleTag(Double.MAX_VALUE);
assertTrue(t.equals(t2));
DoubleTag t3 = new DoubleTag(Double.MIN_VALUE);
assertFalse(t.equals(t3));
assertEquals(t, new DoubleTag(Double.MAX_VALUE));
assertNotEquals(t, new DoubleTag(Double.MIN_VALUE));
assertEquals(new DoubleTag(Double.NaN), new DoubleTag(Double.NaN));
}

public void testClone() {
Expand Down
9 changes: 5 additions & 4 deletions src/test/java/net/querz/nbt/FloatTagTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package net.querz.nbt;

import static org.junit.Assert.assertNotEquals;

import java.util.Arrays;

public class FloatTagTest extends NBTTestCase {
Expand All @@ -14,10 +16,9 @@ public void testStringConversion() {

public void testEquals() {
FloatTag t = new FloatTag(Float.MAX_VALUE);
FloatTag t2 = new FloatTag(Float.MAX_VALUE);
assertTrue(t.equals(t2));
FloatTag t3 = new FloatTag(Float.MIN_VALUE);
assertFalse(t.equals(t3));
assertEquals(t, new FloatTag(Float.MAX_VALUE));
assertNotEquals(t, new FloatTag(Float.MIN_VALUE));
assertEquals(new FloatTag(Float.NaN), new FloatTag(Float.NaN));
}

public void testClone() {
Expand Down

0 comments on commit 72008ac

Please sign in to comment.