Use ASSERT_FLOAT_EQ instead of ASSERT_EQ
Summary: Changes the unit test comparsion to use ```ASSERT_FLOAT_EQ``` instead of ```ASSERT_EQ``` as they check float values. Closes https://github.com/facebook/css-layout/pull/257 Reviewed By: splhack Differential Revision: D4213809 Pulled By: emilsjolander fbshipit-source-id: a79d310840814f26a122e1a0f6db47383b17d7e2
This commit is contained in:
committed by
Facebook Github Bot
parent
49a21e657b
commit
d54f09e32b
@@ -24,12 +24,12 @@ TEST(CSSLayoutTest, start_overrides) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -48,12 +48,12 @@ TEST(CSSLayoutTest, end_overrides) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionRTL);
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -71,8 +71,8 @@ TEST(CSSLayoutTest, horizontal_overridden) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -90,8 +90,8 @@ TEST(CSSLayoutTest, vertical_overridden) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -109,10 +109,10 @@ TEST(CSSLayoutTest, horizontal_overrides_all) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetBottom(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetBottom(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -130,10 +130,10 @@ TEST(CSSLayoutTest, vertical_overrides_all) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(20, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
@@ -154,10 +154,10 @@ TEST(CSSLayoutTest, all_overridden) {
|
||||
CSSNodeInsertChild(root, root_child0, 0);
|
||||
|
||||
CSSNodeCalculateLayout(root, CSSUndefined, CSSUndefined, CSSDirectionLTR);
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetLeft(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetTop(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetRight(root_child0));
|
||||
ASSERT_FLOAT_EQ(10, CSSNodeLayoutGetBottom(root_child0));
|
||||
|
||||
CSSNodeFreeRecursive(root);
|
||||
}
|
||||
|
Reference in New Issue
Block a user