Skip to content

Commit fa31f86

Browse files
committed
fix #196: Fix comparison of special values
1 parent f6c5da9 commit fa31f86

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

include/scratchcpp/value.h

+1-4
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,7 @@ class LIBSCRATCHCPP_EXPORT Value
525525
return stringsEqual(v1.toUtf16(), v2.toUtf16());
526526
default:
527527
if ((static_cast<int>(v1.m_type) < 0) && (static_cast<int>(v2.m_type) < 0)) {
528-
if (v1.m_type == Type::NaN || v2.m_type == Type::NaN)
529-
return false;
530-
else
531-
return ((v1.m_type == Type::Infinity && v2.m_type == Type::Infinity) || (v1.m_type == Type::NegativeInfinity && v2.m_type == Type::NegativeInfinity));
528+
return v1.m_type == v2.m_type;
532529
}
533530
}
534531
} else {

test/scratch_classes/value_test.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1740,9 +1740,8 @@ TEST(ValueTest, EqualityOperators)
17401740
ASSERT_TRUE(v3 == v4);
17411741
ASSERT_FALSE(v3 != v4);
17421742

1743-
// TODO: Enable this after #196 is fixed
1744-
/*ASSERT_TRUE(v5 == v6);
1745-
ASSERT_FALSE(v5 != v6);*/
1743+
ASSERT_TRUE(v5 == v6);
1744+
ASSERT_FALSE(v5 != v6);
17461745

17471746
ASSERT_FALSE(v1 == v3);
17481747
ASSERT_TRUE(v1 != v3);

0 commit comments

Comments
 (0)